Guido Von Rossum on Python
deran9ed writes ""People can get quite emotional about Python, in a way they rarely get about software," says van Rossum, who is now director of Python Labs at Digital Creations. In this question and answer interview, he explains why Python deserves such loyalty, when it is better to use Python than Perl, and why increasing numbers of business applications developers will be using Python for years to come. THe full article is on SearchEnterpriseLinux"
Perl == Good
Pyhon == Good
If you Python and Perl people don't quit yer fighting, I'm gonna force you all to use nothing but Visual Basic!
If you don't stop it right now, I'm turning this bus around and we're all going back to Microsoft!
The only thing that we learn from history is that nobody learns anything from history.
Personally I think Python and Perl are the same toolkit with trivial differences in syntax, and wish language designers would take a leaf out of Mark-Jason Dominus's book and go easy on the theology.
But, FYI, Perl has a coupla thousand killer apps, most of which are available on CPAN.
Industry Standards include:
The Beatles never flamed the Stones. The Stones never dissed the Beatles. And at no time did either party rip on Bob Dylan or badmouth Marvin Gaye. Language designers should celebrate their brethren. Particularly when the similarities so overwhelmingly outnumber the differences.
Perl is worse than Python because people wanted it worse. Larry Wall, 14 Oct 1998
Frankly, I'd rather not try to compete with Perl in the areas where Perl is best -- it's a battle that's impossible to win, and I don't think it is a good idea to strive for the number of obscure options and shortcuts that Perl has acquired through the years. Guido van Rossum, 7 Jul 1992
When I originally designed Perl 5's OO, I thought about a lot of this stuff, and chose the explicit object model of Python as being the least confusing. So far I haven't seen a good reason to change my mind on that. Larry Wall, 27 Feb 1997 on perl5-porters
If Perl weren't around, I'd probably be using Python right now. Tom Christiansen in comp.lang.perl, 2 Jun 1995
Python is an excellent language for learning object orientation. (It also happens to be my favorite OO scripting language.) Sriram Srinivasan, Advanced Perl Programming
I know Perl. Perl has its quirks. I heard about Python and read up on it. I liked it for the most part but hated the enforced spacing rules. Reminds me of COBOL. Then I picked up the pick-axe book for Ruby and found the ultimate scripting language. Why use Python instead of Ruby?
In the immortal words of Socrates, "I drank what?"
Which is ACTUALLY the Anglicized version of vanRossum.
That is, if we want to pick nits.
KFG
You didn't even need to say that you won't consider python as your language, it is obvious from your lack of open-mindedness. When I first used it I thought that it would a difficult transition. Within two days I liked python's methods of doing things much much better. Python codee is very very clean and makes working with other people a breeze. It is elegant and the more you know, the more precise it can get. Try reading the official tutorials, they don't take too long and you can learn python in anywhere from 2 days to a week. It took me about 4 days of alot of reading. You should try it before you bash it.
This Wiki Feeds You TV and Anime - vidwiki.org
It's pining for the fjords.
Yeah, I used to make fun of that too. I'll tell you a little (true) anecdote: I first heard of Python here on /. and its reliance on whitespace for code structure. I laughed and thought that was *such* a stupid idea.
I found it so funny in fact, that I went back to a couple of colleagues and started using Python as the punchline to an in-house joke: you see at the time we were looking for an embeddable scripting language. Python became a threat: "you'd better not do that, or I am gonna embed Python in the server".
Then, I started running into Python on the net, first because of Zope (of course) then on other cool little projects. I started to get curious, and downloaded the language and ActiveState's win32 extensions. I picked a small in-house project to test it on and I was pleasantly surprised: I went from making fun of it to piping serialized Python objects over HTTP (from NT to Unix and back no less) in --literally-- 3 days.
I dunno what your measure of a good language is, but that ease of use and versatility sold me. And, BTW, Python is now my company's embedded language of choice.
And which of these examples gives Python the advantage over Ruby? I think, your examples are exactly the description of Ruby virtues.
Well, of course, I still prefer Perl to those two; but at least Ruby has something that Perl doesn't (-123.abs or mixins, for example). Well, Python also has a unique feature - significant white spaces, but I'd rather live without it ;)
I like perl and I do not know python very well. Like everyone, I've heard python proponents advocate their language, and I've been largely unimpressed by their advocacy. Their advocay generally takes one of the following forms:
... because perl sucks. So this really isn't a way to advocate python as much as it is a way to bash perl.
1. "PERL SUCKS!!!"
I see this one often. Lots of people seem to hate perl for reasons of varying validity.
2. "Python is better than perl"
Like it or not, this is just a toned-down version of #1. Python is better than perl
3. "Python is elegant"
I heard Larry Wall speak at the Atlanta Linux Showcase last year, and he identified "Programmers care about elegance" as one of many myths about programmers. (This is where the anti-perl crowd screams, "It's fitting that that bastard Wall would say something so brain-dead lame!!!") I care about how useful and powerful a langauge is, not how elegant it is. We all know how far elegance took the ivory-tower language known as LISP. If python becomes popular, I believe it will be so because it is useful, not because it is elegant.
4. "Python is object-oriented"
My response to this is: so what? OO programming, while good for many things, is overhyped. OO languages are a dime a dozen.
5. "Python is truly object-oriented"
You'll often see this statement coupled with other statements like, "Perl's object-orientedness was a hack," "Perl's object-orientedness was added later, while python's was included from the beginning," etc. In other words, "perl sucks."
In the article, Guido was generally fair but couldn't help having his argument tainted by #1 and #2 (above). When it comes down to it, I don't want to use python partially because I don't want to be associated with the vitrol which pervades its proponents. It's just a programming language.
I don't make the rules. I just make fun of them.
I've been using Python in my current work environment to thest my COM+ objects. I use it in preference of VB, so as not to scar myself permanently.
Besides the religious beliefs in better computing practice, Python is simply just faster, and easier to get going. (Now if only I can sell it to the rest of the crowd...)
Anyone know if you can write music apps in python? digital audio? Just curious...
for those of you who really care, his name is Guido Van Rossum CmdrTaco wouldn't like being called 'CmdrBurrito' in the media now, would he?
Python has an advantage in that it changes the way you think about programming in a language, suddenly whitespace is important. Its the little things, that make you rethink what you already know about languages. I'd like to start over and learn Python as my first language. This one was designed, not evolved from the past.
Learning Python is not hard (remember how long it took you to learn Perl?) -- you can do it in an evening by reading any one of these free (and Free) online books:
Once you've read any or those, you'll want to dig into some real code, so head over to the Python Knowledge Base for tons of real code examples, and Vaults of Parnassus for tons of free third-party modules and libraries.
-M
The licensing is frightening off a number of people, but I think that you may see that Python will move toward a GPL license soon.
I have no hard evidence of this, but a number of things point toward this.
This is from Smalltalk, which predates Eiffel by a long long time. I think Smalltalk like we know it today is from the period of 1976-78 or so, distilled more formally around 1980. I believe in Smalltalk it looks like 5 timesRepeat: [do this], the for loop looks like 1 to: 10 do: [ :i | block] which seems similar to Ruby as well. I think some of the idea of simple closures instead of functions as objects came from Logo. I.e., you don't pass functions around, you pass closures -- Smalltalk has no concept of functions, only methods, so this was the solution. Logo did it this way just because it was most intuitive.
The Zope site is terrible - trying to find documentation is a nightmare, and trying to find the solutions to what would appear simple problems, like 'how do i use a single, global images folder?' are nowhere to be found in the official docs.
The 'search' facility is brain dead, and it looks to me like nothing has actually been done to the Zope project in the year or so i have been following it, short of bugfixes for the security holes in the product.
Most of the 'Zope Products' indexed on the website are hopelessly out of date and don't work with the current version of Zope.
I have evaluated Zope in the past, and am building a site with it at the moment as an experiment, but I don't think it's a 'Killer App' by any means.
Maybe when it gets a WYSIWYG editor bolted on instead of the TEXTAREA-based editor, and a support site that isn't a total abortion - if theres anything that would put a potential Zope user off, its the Zope site, then they might have something.
I gots ta ding a ding dang my dang a long ling long
Now that Python exists, it may be hard for even those with will -- Ruby and Rebol, for example -- to succede. There was a niche for Python to fill, something that Perl and Tcl didn't quite cover. Tcl is gone, is there enough of a gap in what Perl and Python achieve that there's room enough for another language? I'm not sure. No new language is going to supplant an old language -- at least, not until it has gained a significant following on its own.
Snack: http://www.speech.kth.se/snack/
Here's a blurb:
"""
The Snack Sound Toolkit is designed to be used with a scripting language such as Tcl/Tk or Python. With Snack you can create create powerful multi-platform audio applications. Snack adds commands for basic sound handling, e.g. sound card and disk I/O. Snack also has primitives for sound visualization, e.g. waveforms and spectrograms. It was developed mainly to handle digital recordings of speech, but is just as useful for general audio. Snack has also successfully been applied to other one-dimensional signals.
The combination of Snack and a scripting language makes it possible to create sound tools and applications with a minimum of effort. This is due to the rapid development nature of scripting languages. As a bonus you get an application that is cross-platform from start. It is also easy to integrate Snack based applications with existing sound analysis software.
"""
Erlang.org: wow
Is there something available for Python like the Inline:: modules for Perl? These are modules which make it possible to stick C, C++ or Python right in the middle of Perl code. What would be really cool is if there is a way to hook up Python with any of the thousands of Perl modules which exist out there. One of the nicest thing about Perl is CPAN, a huge online repository of Perl modules for doing just about everything. It would be cool if a Python script can access, say, Perl's Net::AIM module (which provides a nice class interface to AOL Instant Messenger protocol).
Python and Perl are both really nice languages. Anyone who's never used them should give them a try. For certain tasks, it's amazing how much faster you can do things in comparison to, say, C++ or Java or VB. (But every language has its place; I don't believe the "one language fits all" claims that people sometimes make).
Python vs Perl is largely down to personal preference, and what code/modules are currently available that you can build on top of.
perl -e 'fork||print for split//,"hahahaha"'
I agree its a pretty cr*p article, especially, when you consider how articulate Guido is on almost any subject.
It reads like he was interviewed over the phone while he was trying to shave.
Old COBOL programmers never die. They just code in C.
Actually, the Stones dissed the Beatles shamelessly and nearly incesantly. It was, in fact, part of their 'image.'
When a reporter went up to Jagger and told him the Beatles had broken up and asked for his reaction he replied, " Great, that means that now WE'RE #1!"
Little did he suspect that 30 years later the Stones would still be touring, and that the Beatles would STILL be outselling them.
Kinda like loosing an election to a dead guy.
KFG
On the other hand, I have issues with Zope. The documentation is incomplete, and the help system has big smokin' holes in it. There's a Zope documentation project, but I have a problem with systems like this where the code is the spec, and the documentation is being written from that — my own particular anal retentiveness factor, I suppose. Zope doesn't behave quite the way I intuited in the getting-to-know you phase of our relationship, and I've had to readjust my think for a number of Zopisms as I go. Also, the naming conventions (plural) suggest to me a certain cobbled-together-ness — an impression which is carried further by the spotty documentation, etc.
If you want to know about my personal bias in languages, I think Perl is truly amazing in the sense that any language which is so butt-ugly in terms of its syntax and structure (inheriting from C, AWK, and shell scripts???) can be so mind-bogglingly useful and easy to use in practice. On the other hand, all the Perl hackers I've worked with produced utterly vile code. Mind you, they produced pretty damn awful C too. I'd prefer to be working in Python if I had to work with them.
And of course I do work with them, but the powers that be won't let us use Python on the basis that it's not a skill you see on resumes as standard yet. Thank God for The Corporate Mentality, no?
AirSupply: go ahead, cut me off.
This looks a bit like SuperCollider (an object-oriented DSP-processing language on the Macintosh); at least the idea of all types having methods does.
I think SC is derived from/inspired by some other OO language. Which language did constructs like '5.times {do this}' come from: Smalltalk? Eiffel?
"Perl is worse than Python because people
wanted it worse." - Larry Wall, 14 Oct 1998
Erlang.org: wow
These comments followed the string describing the grammar, which contained Perl code for the semantic actions, and which was fed to a method in a parser-generator module. (I tried including a few lines of the code in my post, but Slash gave me the error message: "Lameness filter encountered. Post aborted. Reason: Junk character post." Harrumph.)
--
send all spam to theotherwhitemeat@ropine.com
I am not familiar with Inline::, but... AFAIK, there is "perlpy", a Python module for hooking up to Perl. Jython pretty much is Python in Java, so you can subclass/extend/whatever Java from Python and vice versa. ActiveState's win32com extensions to Python allow full win32/MFC scripting from Python. Tcl is definitily hookable, as there is Python/TK which basically uses Tcl in the middle. I've seen MATLAB modules as well.
For compiled languages, anything that's hookable to C, it's easily hookable to Python. SWIG (swig.org) is of course most people's generator of choice (it does Perl as well, to be fair) but there is also a C++ API (CXX), several Fortran APIs and I dunno what else...
Oops. I guess my Ruby really is shady, but at least I spotted it. The name of the message I meant is actually step, not upto. The latter takes only one argument. Substitute as required. Thanks.
main(O){10<putchar(4^--O?77-(15&5128 >>4*O):10)&&main(2+O);}
The trick is to use a decent editor which has good syntax highlighting. Then, at the point where your error is, everything will turn red (or green or ...). This also applies to C++ and Perl and other languages which don't rely on whitespace - it becomes much easier to spot the odd unescaped quote.
Actually, one thing that annoys me about perl is the fact that it's almost impossible for an editor to syntactically highlight it perfectly. Although this is hardly ever a problem unless you're intentionally being obfuscated (e.g. print qq]hello, world\n];, or s/([^ ])([abc])/local $_ = $2;y!abc!ABC!;$1.$_/ge;, or ${rand > 0.5 ? "b" : "a"}++;).
perl -e 'fork||print for split//,"hahahaha"'
perl -e 'fork||print for split//,"hahahaha"'
Whatever.
People (read: geeks like us) get quite emotional about software in general, and about languages and operating systems in particular. I work in an office where Perl is the dominant language, and the Perl-heads here are quite passionate about Perl. I'm mainly a C programmer myself, and I can get quite passionate about C. (This becomes especially amusing in my office, because I'm implementing a library for C that provides the functionality of Perl, so we have wonderful lunchtime arguments about that, too.) I've seen people get quite overheated about PHP, Python, C++, Eiffel, ML, Haskell, Prolog, Scheme, Forth, assembly language, and pretty much every other language I've encountered, including COBOL and RPG. (Hard to believe? Pick a fight with my mother.)
It's just the nature of the beast. To use and like a language, you have to get deeply into it, and once you see its full possibilities, it's irritating to have to debate them with someone who doesn't know the language as well. The assertion that people get more passionate about Python than other languages is just either pure BS, or else it's marketeering by Guido.
I've used Python, and while I agree it's cleaner than Perl, it also has some annoying features, too. Just like every other language. Frankly, I think Icon is a better text-handling language than either Python or Perl, but that's just my personal needs and prejudices speaking.
What I don't understand -- and this could be equally well aimed at C++ and Java as Perl and Python -- is why people find a language they like and insist that everyone else must use it. It's generally acknowledged that the peculiarly American habit of insisting that everyone speak English is asinine; I wonder why the same conclusion hasn't been reached about programming language advocacy. All non-trivial languages have strengths and weaknesses, and there really isn't much to recommend one over the other except personal preference and practical requirements, i.e., what you already know and the nature of the task at hand.
Diversity is good. This applies no less to tools than it does to people.
--
Proud member of the Weirdo-American community.
Assuming you mean FreeBSD, just log in as root, and execute "cd /usr/ports/lang/python ; make ; make install".
If you don't mean FreeBSD, well: the CPython interpreter is fairly portable, IIRC, and should build under most unixes with little trouble.
Here's three for you, and chances aren't bad that you've already come across any or all of them:
So. Now you've seen three major projects written in Python, and chances are this isn't the first time you've seen one or all of them. Like Linux, Apache, Sendmail, and yes Perl, if you use the internet at all then you probably interact with Python all the time without necessarily realizing it. It's a nice, clean, scalable lanaguage who's one main drawback -- it's slow -- is handled nicely by the fact that it's so easy to integrate it with C. As a result, it gets easy to maintain a large, complex project in Python while optimizing bottlenecks with pure C modules.
Perl can pull some of the same tricks of course, but it's much messier. I like Perl, I mainly use Perl, and I'm not knocking it. But I really can't see the point in arguing the matter: Python is a much cleaner language that is far better suited for large scale projects. If you haven't come across it yet, maybe you just haven't done anything big enough yet.
DO NOT LEAVE IT IS NOT REAL
Python ( http://python.org/ )
+ Qt ( http://www.thekompany.com/projects/pykde/ )
+ Firebird ( http://firebird.sourceforge.net/ )
+ gvib ( http://www.zope.org/Members/RETierney/gvibDA )
=
A delicious cross-platform substitute for my obese friend Swing.
---
Erlang.org: wow
An alternative option is to put "use English;" at the top of your script. Then you can call the $! $? $_ $% $, $; variables by their more readable names: $OS_ERROR $CHILD_ERROR $ARG $FORMAT_PAGE_NUMBER $OUTPUT_FIELD_SEPARATOR $SUBSCRIPT_SEPARATOR etc.. You can tell they're "magic" variables, cos in Perl the convention is that upper-case variables are ones which mean something special to the interpreter.
open HANDLE, "hello.txt" or die "cannot open hello.txt: $OS_ERROR".
perl -e 'fork||print for split//,"hahahaha"'
Were you using perl v 4?? (released in about 1992) Modern perl has classes! man perltoot.
use Net::FTP;
my $ftp = Net::FTP->new('ftp.server.com', Debug => 0);
$ftp->login('anonymous', 'e@mail.address');
$ftp->get('file.txt');
etc.
I take it you never put "#!/usr/bin/perl -w" at the top of your perl scripts? Look at man perl, and search for "-w" to see quite how many times you're told to enable warnings like this. Also put "use strict" at the beginning of your scripts.
BTW, if you do "-w", the error you get is this: Name "main::varaible" used only once: possible typo at -e line 1.
perl -e 'fork||print for split//,"hahahaha"'
That's because Perl's OO used Python's as a model, so of course they're similar.
The standard Python implementation is interpreted, it's as cross-platform as Perl or Java or whatever. There's also a pure Java implementation of Python, Jython, which I've found very useful as a scripting tool in a Java environment, as you get full access to Java classes from Python.
Python is a scripting language, so I use it in preference to Java where a script is called for, eg - rapid development environments.
I am not gonna argue that Python has more features or tools than Perl. God no... and Python IS sorely missing a CPAN-like archive (no, the Vaults won't do).
The main difference (besides subjective likes/dislikes, of course) between the two, is that Python is a descendant of general-purpose languages (albeit, mostly academic ones), while Perl is a descendant of specialized languages (shell scripting, AWK).
As a result Python tends to be easier for begginers to understand. That's not a bad thing, and it's not trivial either...
If you honestly think that Python's signficant whitespace is a serious problem, then my advice to you is to get a real text editor.
Honestly, Emacs's Python mode is so straightforward that it's almost comical. I missed the semi-colons and braces for approximately five seconds. Vim will also do all the "hard" work of indenting for you. I suppose if you are still editting in ed Python might be problematic, but that's not Python's fault.
What I got from the article:
Python is a cleaner language, thus better for larger projects and teamwork.
Granted, if true, that's a worthwhile thing. But's that's precious little to say in the way of discussing a language, and it's quite vague. C'mon, how about some more discussion of features of the language. How about some real comparison, with say, strengths and weaknesses of Perl. My knowledge of Python (almost zero) has increased not one bit after this article.
Basically, the article amounts to: Hey, I wrote Python and I like it. It's better than things I didn't write.
Is this an interview or a press release?
Don't get get me wrong, attention to detail in programming is a good idea. Formatting your programs is very important. Spaces should not be. They are the void on the page. Various editors treat spaces, that is, it's harder to manage in some. It's just a shame that they put this 'feature' in a language.
-- these are only opinions and they might not be mine.
I don't know much about Python... but is it very cross-platform?
;)
Yes. It even has bytecode, that (IIRC) can be run on any platform that has the correct Python interpreter.
As for GUI-toolkits, there are several to choose from, and they are supported on several platforms, but probably not as many as Java AWT/JFC.
Is there a reason you'd use Python over Java if you wanted to run your application in a few different environments?
Yes, you would be using Python instead of Java. That's a plus..
I don't know python and I might like to learn it. Before I do though..
What I like best about perl is CPAN. Perl can find and load a CPAN module for you and CPAN is full of well documented well tested code which saves me days and days of work.
Does python have anything resembling CPAN?
War is necrophilia.
I don't like whitespace. Especially if your code is over a screen long and has multilevel ifs and whiles and such. As you get to the bottom of your code you never really know what you are closing. I also don't like braces for the same reason. What I do like is the new PHP
if:
else:
endif;
blocks PHP now supports a endoperator for every structure including foreach, switch, while etc..
super cool.
War is necrophilia.
On that note, it would be rather interesting to see Java and Python go head to head in a bunch of code benchmarks, no? :)
ObJectBridge (GPL'd Java ODMG) needs volunteers.
Finding God in a Dog
I'm learning Python now. It's a much cleaner language. Consider the following Perl:
for($i = 0; $i < 10; $i += 2) {
print $i;
}
And the same in Python:
for i in range(0,10,2):
print i
How about this in perl:
print foreach 1..10;
or just this:
print 1..10;
(admittedly that doesn't generalize well)
I'll overlook the fact that you didn't know about the suffix statement notation (putting the foreach after the action), which few people use because it *is* confusing. But you didn't even use the range operator, choosing the most noisy syntax possible instead.
$variable = 1;
print $varaible;
use strict. that's what it's there for. You are simply not qualified enough in perl to make the comparisons you are making.
--
I've finally had it: until slashdot gets article moderation, I am not coming back.
.. it's so portable, it will even run under perl - Inline::Python ;-)
;-P
.. if your a masochist.
I advise people not to use Python for the following reasons: 1) Python has had license issues. Guido does not want to relinquish final control over Python, and he wants to get paid for what other language implementors do for free. 2) Python is defined by it's implementation. There's no standard for developers to rely on. That means ultimately you are at the mercy of the good or bad judgement of the Python team. 3) New versions break old programs. I do NOT want my customers to have to have 2 or 3 versions of Python installed. 4) There are better alternatives. Lisp or Ruby.
...and just as newsworthy....
Larry Wall thinks Perl is pretty cool.
NO CARRIER
If you're looking for a more technical summary of Python, you can always read Eric Raymonds thoughts on it. you can find it here. http://noframes.linuxjournal.com/lj-issues/issue73 /3882.html
It turns out it's super easy to integrate into a C or C++ base and nearly instantly gives you a very solid scripting language. Restricted execution allows you to limit the power of the scripts, perhaps only allowing access to a few of your own custom objects and none of the system calls. This allows us to trust scripts from relatively untrusted users. All in all it's been a dream to use.
I was a little weary of having to learn a new language. Having to have C, C++, Java, VB, perl, javascript & shell under your belt seems excessive. I wish we could settle down and use a few LESS languages, but whaddya gonna do?
Once I jumped in though, i found it really easy to learn and nice to work with. Most modern languages seems to use so many of the same concepts, it's hardly like picking up a new one (I felt the same way about java). So it was really painless.
I would suggest anyone who's on the fence to give it a try because really it's only a couple of days before you've got a pretty good command of it
Sleeper
However, I still don't like Zope much, even though I really want to like Zope. It doesn't have the things I so love about Python -- simplicity, consistency, and a small set of orthogonal features which interact well together. DTML and Zope in general seem to have some sort of funny dynamic scoping to them, and the mapping from URL to object database to the python object model isn't intuitive to me. When you do something new in Zope, there's a very good chance it won't work the first time. That's not true of Python, in my experience.
For these reasons, I've been looking more closely at Webware, which seems to have a much less ambitious goal, and thus much more chance of success.
People have been talking about how Zope will be a killer application for a while now. Maybe it will happen, I very possibly may be converted myself, but I don't think it will necessarily happen. It would be very easy for Digital Creations to lose sight of the goal by incrementally adding features they need without rethinking what they've already done. Down that path leads Perl, and I know I sure don't want to go there.
First off sorry for the typo on submission of the article... Tom Christiansen wrote a nifty little comparison between Perl vs. Python. I've used Python quite a few times and don't know Perl well enough to even consider myself a programmer. However many times I've had to modify plenty of Perl scripts in order to use certain things I found useful, and one reason I would use Python over Perl is its ease of scripting. Perl can sometimes be confusing as heck.
According to Jon Udell here are his findings on Perl vs. Python
Perl Is Bigger, But Python Is Growing Faster.
Python Is More Deeply Object-Oriented.
Perl Is more Powerful And More Mature In Some Ways.
Perl Lacks A Killer App, Zope Is Python's Killer App.
Python Is Designed To Be A Good First Language For A Beginning Programmer, Whereas Perl Is Most Useful To Programmers Familiar With C, Sed Or Awk, And UNIX Command Idioms.
His complete write up is here. (warning the article is a bit long... 4 pages)
And finally Python Humor
360 degrees of Karma
I also like the fact that you can look at a small bit of Python code out of context and figure a lot out about it. There are seldom hidden side effects (not necessarily by language design, but mostly by accepted convention and style). You can trace all the functions -- there are a handfull of top-level builtin functions, and everything else is modules or methods. Because Python encourages being explicit about modules (e.g., using string.join, where join comes from the string module), it's easy to figure out where everything is defined.
Those are a couple of the things that I think make Python easy to read and easy to maintain.
But most of all, I like Python because I can do what I want to consistently and efficiently. There aren't any surprises. I feel like Perl has an emphasis on being a language that can do eclectic things. But I don't want my language to do eclectic things, I want to do eclectic things with my language. A language should be a reliable and predictable way to express my intention. If I understand the language fairly completely (and it doesn't have horrible deficiencies, like Tcl for instance), I can do what I want. I could never understand Perl enough to work with it without surprises. Without ever hacking on Python internals, I feel like I understand the language pretty completely.
As far as new versions breaking old programs, I haven't seen the problem. Python v2 adds a number of things, but hasn't really broken anything. There are plans to deprecate old features, but these are mostly in cases where old features were found to encourage or enable bad programming practices or the behavior is unintuitive, and where it's not hard to fix the program. Even so, there are plans to put in warning features and ways to run the interpreter in backwards-compatible modes. These should come to fruition before serious backwards-incompatible changes are made.
Too bad the real world always does not allow such a luxury. Tell me you never scrolled up to see what the hell you were closing.
War is necrophilia.
Who is he kidding? In my years as a professional programmer of financial applications, data servers, ecommerce frameworks, embedded systems, and web sites, I have seen a plethora of projects successfully that used Perl, and exactly zero that used Python. Python ain't exactly the ubiquitous standard the Python community thinks it is.
There are a lot of application developers using Python in Web development. Even more using Perl, to be sure.
The other examples given--glue applications, database applications--have been successfully served by Perl for a long, long time. Honestly, who hasn't written a simple protocol server in Perl before? Who hasn't written basic databases in Perl?
I think Guido might be eating a little too much of his own dog food. Python may be a rising star (who remembers Objective C?), but Perl is still king.
S.
"Python would be used for higher level control of an application, and Java would be used for implementing the lower level that needs to run relatively efficiently."
I never thought I'd see the day when Java was mentioned in the same sentence as "lower level" and "efficient."
*shudder*
Let's try not to let fact interfere with our speculation here, OK?
For RAD Ruby is a clear-cut winner. You have many high level concepts available in the language or the accompanying library (which is almost the same, since it's true OO). The most important and visible: each. No more for (i=sz; --i >= 0; ). Its also got lamdas, closures and eval. If there are some concepts missing in the language, it's usually possible to extend the language and reuse that extension again and again. At no cost of readabilty as in Forth. Oh, and did I mention everything is an object?
Whatever you can do in Python, Perl or Smalltalk, you can do in Ruby (as a language at least). The accompanying libraries are pretty sweet too. Try it, you'll like it.
- Steeltoe
http://www.debunkingskeptics.com/
...but it's not there yet.
:-)
I have respect for Perl (hell, I have respect for any general-purpose language than can beat egrep in text searches), but Python is my weapon of choice.
What people are missing in this forum is that Python is probably the most extensible language out there: there are at least 4 different interpreter implementations for Python (and I don't mean OSes): there's C-Python, there's Jython (in Java), there is Stackless Python and there will be a Python.NET. That's versatile guys, much more so than any other 4GL language out there.
Also, Python is hacker-friendly: armed with a couple of tools and a C compiler anybody can embed the interpreter in their own app or extend Python with existing C, C++, Fortran, Java, or even Perl code. Trust me, it's much easier than you think.
Python is easier for begginers to pick up: if you have a diverse group of people with different skills, you can use Python as a lingua franca. No reason to explain the legacy behind $_ or other such awkiness
Most importantly though, a choice of language is a personal one: I liken Python code to a mathematical proof: it's clean, it's elegant, and if it's written by someone else a reader can easily pick up its deficiencies. Perl tends to be more like poetry: it can be beautiful (like that great DeCSS hack) but its beauty is subjective, and much like poetry a lot of people may never 'get it'.
At any rate, if you are a Perlista and you're here flaming away because of the whitespace thing, go to python.org and try the language out. My bet is that you will be happy to have done so.
Dylan is more elegant than even Python, but was designed to be efficiently compiled. This is from an interview with Guido in the linux journal (http://www2.linuxjournal.com/lj-issues/issue68/37 09.html):
Phil: It seems like Python is starting to be taken really seriously in web development and so on. Is Python being taken seriously in academia? I guess I mean relative to Perl, because Perl isn't, as far as I can see.
Guido: I would say Python is being taken a lot more seriously. There are language designers who don't approve of certain short cuts, or the fact that Python doesn't have static typing, or the fact that there are other languages out there that are as good as Python is, and again borrow all the good features from those languages.
Phil: What languages?
Guido: Some people think, for instance, that Dylan--which I think has a very academic flavor--is everything Python is plus so much more.
Phil: Dylan? I've never heard of it.
Guido: Well, that's exactly Dylan's problem. I don't know, but I think it started out as a LISP variant, with sort of an alternative syntax. The syntax was deliberately unLISPish in order not to scare off everyone who is not already brainwashed with LISP, because LISP has one of the biggest image problems of any programming
language in the world.
I've written a pretty good amount of absolutely hideous Perl code (maybe 10000 lines total -- hey, I'm still a student), and maybe even once a clean, reusable program. But the latter are the exception. Perl lends itself to stream of consciousness programming, which is great when you want to write a quick script to do something, but doesn't lend itself to later revision.
I'm learning Python now. It's a much cleaner language. Consider the following Perl:
for($i = 0; $i < 10; $i += 2) {
print $i;
}
And the same in Python:
for i in range(0,10,2):
print i
It's just easier to read. The main reason I don't feel like continuing on in Perl is because I once seriously shot myself in the foot due to Perl's lack of easy to use and easy to understand complex data structures. Python has classes, which are just like JavaScript (really just hashes), but the syntax makes them usable.
And error checking as well. The following is probably wrong Perl:
$variable = 1;
print $varaible;
But it isn't an error. The following causes an error in Python:
variable = 1
print varaible
If I wanted an undefined value, I can, of course, create one:
variable = None
print variable
I have seen a plethora of projects successfully that used Perl, and exactly zero that used Python.
Yahoo, Google, and eGroups all use Python extensively.
So in your future ignorant flames, you can now say: Besides the biggest portal, the best search engine, and the most popular e-list site, I know of zero sites that use Python.
The wonderful thing about perl as opposed to other languages is that everyone in the perl community is so open about "more than one way to
do it." If a beginning programmer reads Programming Perl, 3rd ed. (great book, by the way) all the different ways to do an operation will be listed. "You can do it this way, or this way, or this way. It doesn't matter which one. They all mean the same thing". Nearly all other programming languages also have "more than one way to do it" but are rarely if ever honest and upfront about it. If the programming book they read shows only one way to do it (which many non-perl programming books are notorious for doing), and there's actually two or three different ways to do it, they're going to think the other ways to do it are completely different procedures, and they'll expend a whole lot of unnecessary energy try to figure out that the two or more instructions are the same. Perl's honesty about different ways to do things actually makes it easier to learn than many other languages.