View Poll Results: Which do you prefer: Perl or Python? | |||
Perl |
![]() ![]() ![]() ![]() |
0 | 0% |
Python |
![]() ![]() ![]() ![]() |
3 | 60.00% |
They're similar, just a matter of preference |
![]() ![]() ![]() ![]() |
2 | 40.00% |
Voters: 5. You may not vote on this poll |
Post Reply |
|
Thread Tools | Search this Thread |
12-21-2007, 10:43 AM | #1 |
Shadow Warrior
![]() 159
Rep 2,095
Posts |
![]()
Curious to hear from some experienced programmers. I haven't dabbled in either Perl or Python but from what I know they can be handy for scripting quick tasks with efficient speeds and results, as well as using a lower number of lines of code to achieve a task compared to other popular languages such as C++, C# etc. (for example regex parsing). I believe MS uses Perl mostly while Google uses Python. Although I've heard there is that IronPython .NET extension of Python.
So any major differences between the two? Is there such a thing as one being better than the other, does it depend on the task at hand, or is it just a matter of personal preference? Which one would you suggest to someone if they were interested in learning? Picking up on one of these is on my to-do-some-day list ![]()
__________________
![]() Mods: PIAA Angel Eyes, Rear Fog Switch, Escort X50 Blue hardwire, 30% Charcoal Llumar Installing soon: Rear Power Outlets (Happy Robot mod!) |
12-21-2007, 11:37 AM | #2 |
Brigadier General
![]() ![]() 2062
Rep 4,365
Posts
Drives: '07 Z4 Coupe, '21 X3, '16 GMC
Join Date: Aug 2007
Location: Iowa
|
Depends on the task at hand. Personally I think of Python as more of a replacement/addition to Java than anything else. I have dabbled in it and I was not too impressed.
I would personally learn Perl first as I think anything you want to do with Python can be easily done with various other languages as well. That and I have only heard speak of Perl... Both are better than VBA though! ![]()
__________________
2007 Z4 3.0si Coupe • 6 MT • Black Saphire Metallic • PP • SP
2016 GMC Sierra SLT Z71 Premium Plus 4x4 2017 Harley StreetGlide • Denim Black • V&H Tune 2021 BMW x30i • Phytonic Blue Metallic • Fully loaded |
Appreciate
0
|
03-16-2008, 11:25 PM | #4 |
Member
![]() 4
Rep 47
Posts |
Whoa, I'm replying to this thread about 4 months late, but what the heck...maybe the OP will come back and read it at some point. : ) I've done development in Perl off and on for about 12 years now, and like 6-7 for Python. Both are high level dynamically typed languages that excel at letting you get things done quickly, by trading off some amount of runtime speed. Like anything, when it comes to picking the right tool for the job it's all about what's most important and what the tradeoffs are. I've done a fair amount of C/C++ and some Java as well, and in my mind these are lower level systems/application languages that don't have a lot in common with the scripting languages like Perl, Python, Ruby, TCL, PHP, etc (so I disagree with the Python being a Java replacement idea mentioned above). Anyway, here's one person's view of the pluses and minuses of the two languages:
Perl ---- + Highly optimized for speed of development. You can do a lot in a small amount of code. + Powerful...lots of different ways to do things. The motto of Perl is "TMTOWTDI"--There's More Than One Way to Do It. + Really great for text manipulation. Regex matching, etc can be done really trivially and the regex backend code in Perl is insanely optimized and fast. - So optimized for speed of development you can write code you won't recognize or understand in 3 months. : ) This is in fact the main criticism of Perl...it's been called a "write-only" language due to the difficulties in understanding already written code. - Because it's so powerful, there are many different ways of doing things, which contributes to the readability problem. People tend to learn subsets of Perl, and when you try to read someone else's code they may do things you've never even seen before. - Certain constructs and things in the language seem "kludgy". Particular object oriented stuff--feels sorta like a hack. There's a lot of black magic under the covers of some things, and certain things just seem counterintuitive or just plain weird. Python ------- + Also optimized for speed of development...like Perl, it's a dynamic scripting language so you can do loads with small amounts of code. Not quite so optimized as Perl, but this helps to make things more consistent and simple when it comes to syntax. + Elegant. More than anything else, this stands out to me...Python code is about the closest thing to executable pseudocode I've ever seen. The object oriented stuff is great...very simple and elegant. Namespaces and creating modules, a bit of a pain in the neck in Perl, just seem so simple it's ridiculous. + Readable. Unlike Perl, Python code is very readable. Because the philosophy is different ("There should be one--and preferably only one--obvious way to do it." vs. Perl's TMTOWTDI), Python is simpler to learn and more consistent. Often while trying to do something the first time your first guess will actually be how it really does work, very unlike Perl. : ) - Whitespace is significant. This bothers some people. Hell, I thought it was stupid when I first heard about it, but after trying it I actually like it now. : ) - Very slightly more verbose than Perl--this is part of the tradeoff of being more readable and understandable. The effect is almost negligible though, compared to how much less code it takes to write something in either compared to Java, C++, C#, etc. So I end up writing quickie 50 line script to do crazy parsing in Perl, and anything that's going to grow and be part of a sizable body of code in Python. Especially if I want to do OO stuff, it gets done in Python. Both languages are cool and both have their quirks, but I find coding in Python the most fun and productive. YMMV. : )
__________________
e90 335xi / 6MT / titanium silver / black leather / premium / cold weather / sport / iPod
|
Appreciate
0
|
03-24-2008, 08:12 AM | #5 | |
Shadow Warrior
![]() 159
Rep 2,095
Posts |
Quote:
![]() ![]()
__________________
![]() Mods: PIAA Angel Eyes, Rear Fog Switch, Escort X50 Blue hardwire, 30% Charcoal Llumar Installing soon: Rear Power Outlets (Happy Robot mod!) |
|
Appreciate
0
|
04-01-2008, 03:27 AM | #6 | |
you know he kills little girls like you
![]() 403
Rep 892
Posts |
Quote:
![]() |
|
Appreciate
0
|
Post Reply |
Bookmarks |
|
|