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"
> > Python is used pretty much across the board, much more across the board than Perl.
> Who is he kidding?
I think you've taken this up wrong. I think he
meant that Python is more suitable for a wider
variety of applications than Perl, which sometimes
shows its origins as a string processing language.
Edna is a streaming MP3 server that allows network access of mp3 files over HTTP. I also found another useful article on the O'Reilly network about analyzing sound files in python
You wouldn't normally find me evangelising about this or that language.. but since I started using Python ('bout 18 months ago) I've barely used anything else.. it's a truly impressive acheivement, I believe, and a superbly pragmatic one at that. The sheer speed with which you can get an algorithm down in Python is, IMO, it's greatest strength. Add in to that all the object oriented features that you'd generally use day-to-day in C++, great ease of embedding and extending, powerful, *native* data structures and 90% cross-platform compatibility, clear syntax.. it's just *such* a productive language. I used to be a serious C++ guy but these day's I only go near that if I really have to.. for high performance apps were you *really* have to squeeze that last bit of performance (and, honestly, how many of those are there these days with clocks so cheap) I just migrate the critical bits to C/C++ and use a Python main line to drive 'em.. (see SWIG for a cool way to wrap existing code). I ain't gonna get into the Perl argument.. personally it just looks to me like the Perlophiles are just arguing against to protect their intellectual investment. IMHO, Perl is nothing like a full or proper language. Python can certainly claim to be.
X attracts people to Y, because no other system can provide X.
In your example, professional color features (Pantone, CMYK, etc.) is the "killer app" features for Photoshop.
You're right, cool program can not be "killer app" for a language just becaus it's cool. Of course, we could imagine it's not possible to write some progam X in any language other than Y... That would make the program X "killer app" for Y. But that's just speculation, Zope is not such a program.
However, Zope is not just a program. It's rather a framework, allowing you to ad your own code to the system. So, theoretically it could be the "killer app" for Python.
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.
Mathematical proofs are only sometimes clean and elegant, and they're virtually never comprehensible by someone who isn't a mathematician in the same field (unless you're talking about very basic proofs). Mathematical proofs are one of the most obscure pieces of language that you'll find on earth, not one of the clearest, as long as you're talking about people who aren't completely fluent.
Anyhow, I don't use python for two reasons:
1. Perl can do anything that python can with about as much ease (minus the facts that they each have a few minor strengths and weaknesses that the other is better or worse at)
2. The general arguments in favor of python come in the form of either
(a)I'm too stupid to understand perl so python is better
(b)I just like python better because it's so regular
Well, I like perl so much because it's irregular. As larry wall once said, "Since English is a mess, it maps well onto the problem space, which is also a mess, which we call reality. "Similarly, Perl was designed to be a mess (though in the nicest of possible ways)."
I always find it kind of funny when people talk about coding in natural language, since perl is in many ways quite like a natural language. For one thing, it's gone through a sort of huffman-coding: the stuff you use a lot is short and easy to use. Also, the same character or groups of characters can mean different things in different contexts. This is another piece of efficiency as in general it means that you can use the shorter stuff more often, and have to remember fewer symbols.
The great part about perl is that it is a language in a very real sense. It is quite irregular, but quite usefully irregular. And the best part is that it has no hangups about being irregular when it would be useful to do so. That's why, I think, so many people find perl to be so fun. It was designed to make the easy stuff easy and the hard stuff possible, not to make Guido Van Rossum happy if he looks at your code.
And that, I think, is the reason that I'll do my best to never use python - I don't like people telling me how to do things. One of the fundamentals of python is that it enforces Guido's coding style as much as possible. That's just not a friendly environment. Who wants to trust an interpreter which doesn't trust them?
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
But you can just do
foreach (2,4,6,8) { print }
with perl. That doesn't seem weird to me.
Pearl is a language.
-Docvert converts MSWord to OpenDocument, clean HTML
True, true, true. Ok, so it's the pathetic excuse for lambdas IN ADDITION TO reference counting that keeps Python firmly in the world of joke languages. But it's so close! It's frustrating in the extreme to have to deal with a language that's ALMOST the right thing. Why can't more people get on the LISP bus? Are they just so ignorant (please don't answer)?
Peace,
(jfb)
To spur "enterprise Linux," Big Bang, the distributed two-phase commit.
"""
for(0..10) {
print unless($_%2);
}
"""
Is this example supposed to *dispute* Perl's reputation for unreadability, or is this a joke?
-DA
You just helpt him poove his case.
I've written a LOT of perl in the past but I switched to python because of the strange artefacts like $_.
Detail: modding by powers of 2 is implementable as a bitwise AND, which is damn near close to the most efficient thing that you can do on your computer.
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
Have to agree here.. *readability* which, IMHO, is one of the most important traits of any system of notation (which a programming language most definitely is) is one of Pythons greatest strength.. principally because so many of the concepts and structures are suitably similar to the language the most of us probably know.. C++.
Those who view the area as "theirs" tend to reserve its nominal use to themselves.
Didn't this arise as a minor issue with regard to Valery Giscard d'Estaing a few years back?
This next song is very sad. Please clap along. -- Robin Zander
The german "von" does indicate some sort of Aristocracy. This is the same in English; the bad "Guy" in Robin Hood is "of Gisbourne", which would be taken to mean he rules the place rather than just lives there.
Old COBOL programmers never die. They just code in C.
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 ;)
Ok, so you like the python way of doing loops better than the perl way. I like the perl way better. So far, all either of us has offered is personal opinion. The thing is, you're on crack if you think that your opinion is universal, considering that it's not in C, C++, Java, or Perl, all of which are individually much more popular than python and collectively make python look like a spec of dust.
Second, did you write your "10,000" lines of perl in a complete vacume? You've never ehard of nor seen "use strict;" which will generally speaking catch misspelling errors? Btw, the html lines in here documents don't count when you're doing line counts of your perl programs.
Btw, your basic argument above is that you're a bad coder and only occasionally stumble onto good coding style, so python's bondage and discipline style is good for you because it doesn't let you write the horrible code that you naturally do. Ok, well since you've identified yourself as incompetent programmer, why exactly is what you say of any value? You stated at the beginning that you don't program well. Is your advocacy just for bad programmers, then?
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
any chance for a python:DDL interface?
.
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.
Wrong.
Python got full garbage collection in 2.0.
As for lambdas, if you want to write lisp, use lisp.
-DA
Clearly you don't actually use your code or software for anything. Then you might actually care about something as important as the license. humm, tools, schmools hey, I can always reinvent all my wheels, and start over with the next big language when Guido or the company he works for does something stupid with python. Anyone with a business plan, and any hope of something beyond the hobbyist level has to care about the details.
The current Slashdot moderation system is made by gay communists!
I think its time to port slashcode to python..
who's with me ??
Seriously. I don't think python is used "pretty much across the board, much more across the board than Perl."
Perl's community and cpan archive can't be beat...
I thought it was interesting that when asked "in what situations would people use Java instead of Python?", Van Rossum didn't even mention the cross platform application of Java as being a reason to use Java.
I don't know much about Python... but is it very cross-platform? Is there a reason you'd use Python over Java if you wanted to run your application in a few different environments?
A lot of people complain about Python's required use of whitespace, but I've never found it to be a problem. I always use consistent indentation in my programs no matter what language they're in. So I find this feature to be a plus, because I never have to run into the common mistake in C of confusing indentation with for and if statements, like the following examples:
C
if (a==b)
pr intf("a equals b\n");
else
pr intf("a not equal to b\n");
pr intf("Always runs, regardless of a and b\n");
Python
if a == b:
pr int "a equals b"
else:
pr int "a not equal to b"
pr int "This is part of else clause"
(Blame Slashcode for the extra spaces in the print statements.)
Note that in the Python version, the behaviour is exactly what one would naively expect from a single glance at the arrangement of the code. Even non-programmers can read Python code and understand it readily. I find that Python implementations of algorithms look a lot like the pseudo-code I had to generate for assignments when I was in school.
Indeed, I consider Python's use of whitespace to be an advantage beyond merely preventing this common mistake. After starting my internship at a big company with a multi-million line codebase, I'm strongly of the opinion that the source code should clearly communicate its intent to human readers. Python makes it difficult not to write clear, readable programs, without relying on the strong programmer discipline needed to write maintainable programs in other languages.
Along these lines, the one feature of Python syntax that does get in my way is the colon. I sometimes forget to add colons (like the one on the end of the else statement) precisely because I've gotten used to the increased indentation being sufficient and necessary to communicate my intent.
Another annoying thing is that the line ending characters must be the ones defined on the local platform, so I can't move a script from my Linux box to my Mac without running it through a translator. This will become a big issue as the Mac and Unix versions of Python merge together for Mac OS X.
I haven't looked in any great depth at either Perl or Ruby, but my initial impression is that their syntax is a little foreign. I was able to learn Python quickly precisely because the syntax was familiar and predictable. This is consistent for me - I originally came to Python from the Dylan world, a language whose claim to fame is being Lisp-inspired but with an infix syntax to be palatable to C programmers.
Since taste in syntax is a personal thing, I'm not going to flame Perl or Ruby users (indeed, both languages are cool and have their strengths). But I do encourage people not to obsess on the whitespace issue when considering whether to try Python or not.
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.
Amen.
Moreover, Pythoners should easily be able to read Lisp - ignore the parentheses and read it by the indentation (while one is writing Lisp code, a decent editor will take care of most of the details with parentheses). That's what we Lispers do, isn't it? And it's exactly the same argument Pythoners make vis-a-vis reading and writing their language.
And let's not even get into how wonderful CLOS is. :-)
You mention "white-space nonsense" as a reason not to use python, yet your examples are all indented. Since you're so concerned about whitespace being nonsense, why indent? Why not simply write:
def writeln(str)
print(str, "\n")
end
Readability, right? If there were a lot of statements and nested blocks in writeln, we want to be able to pick out the block structure clearly. As it is, writeln is practically a python function. If it were it would look like:
def writeln(str):
print str
Wow, it's indented exactly the same as yours! Even better, there's no lame end keyword! The block structure we perceive is the same block structure that the interpreter will see. No more problems like those you occasionally make (in C, for instance):
if(foo)
bar();
baz();
Where your eye sees baz indented under foo, and you think it will only be executed if foo is true. It seems a lot better to me to have the compiler and person writing the code use the same things to delimit a block of code, rather than have one for the compiler, and another that people use for readability anyways. I've never met anybody who didn't indent their code.
That was pretty funny. But it's important to note that sometimes readability isn't a big issue. There are times when I want to quickly write something on the fly in 15 minutes to perform a task (analyzing the contents of a text file, say), and I'm not going to use the program later, or it's short enough to where it won't be too difficult to see what's going on. If I need to write a quick script for an easy-to-describe, but time-consuming-to-do-by-hand task, then I want a language that allows me a quick and dirty solution. Sometimes, the terser I can be, the better. Granted, my example is perl's forte, but even outside of that, this still can hold true.
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
It just smells funny...
there's C-Python, there's Jython (in Java), there is Stackless Python and there will be a Python.NET
Also, there's an Objective CAML implementation and there's pippy (for palm pilot).
Sumner
rage, rage against the dying of the light
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"'
Python 2.0 supports full-blown garbage collection. Cyclic data structures aren't a problem.
Sumner
rage, rage against the dying of the light
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.
OK, you never get away with saying 'I think' on the Internet, so I delved into it a bit more. I found this:
From The German Nobility:
The basic designation of the nobility is the predicate "von", which the vast majority of German nobles carry. There are a small number of noble houses, almost exclusively of the Uradel, which have never used the "von" or any other noble predicate, but are nevertheless of fully equal standing with those that do.
I haven't read the whole article, but I have no doubt that not all people with 'von' in their names are noble (stupid word) either, but there's a definite link here.
And yes, 'van' just means 'of' and the Dutch 'van' is no indication of nobility.
Regards,
Xenna (I varned you I waz an expert!)
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 -e 'fork||print for split//,"hahahaha"'
"Perl is worse than Python because people
wanted it worse." - Larry Wall, 14 Oct 1998
Erlang.org: wow
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf("Just Another %s Hacker",x);}};print JAxH("Perl")'
Inline currently supports C, C++, Python, Java, and even a handful of Assembly languages. The list will grow, because Inline has been setup as a framework to allow anyone to bind their favorite language to Perl. In fact, all of the languages besides Inline::C were written by other programmers.
Neil Watkiss, the author of Inline::Python, is planning on writing Inline functionality *for* Python. If done right, this might allow Python to make use of many of the CPAN modules. Stay tuned.
For more information you can read a recent article at http://www.perl.com/pub/2001/02/inline.html
To get involved join the inline@perl.org mailing list. See http://lists.perl.org/showlist.cgi?name=inline for details.
Cheers, Brian
>Which language did constructs like '5.times {do this}' come from: Smalltalk? Eiffel?
Smalltalk has such things (with slightly different syntax), but I don't know enough history to tell you if they originated there.
>Python Is More Deeply Object-Oriented.
not really. It's still a procedural language pretending to be an oo language. It's completely random which function are class functions and which aren't (do I do list.len() or len(list)? err... gotta look that up). The data hiding, like perl, is by convention.
It's a marginal improvement from perl, at best, mostly because the notation is cleaner.
... and then there's that damn whitespace issue.
After all the HYPE HYPE HYPE I was horribly disappointed with python.
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...
If you can't do either of these, write a short script (in Python) which will reconcile your tabs into spaces or vice-versa.
All kings is mostly rapscallions. -Mark Twain, The Adventures of Huckleberry Finn
Now, I'm generally of the opinion design is most important, and one should choose a language (a) for the job, and (b) that one likes, but I can't help but use this opportunity to plug Ruby.
u by .html
I have been using Perl heavily, and love it, but Ruby is so damn cool and clean!
Witness, for example, the following three implementations of "Hello World", a la Ruby:
(1)
class Foo
def hello
print "Hello, World"
end
end
(2)
def writeln(str)
print(str, "\n")
end
writeln("Hello, World!")
(3)
print "hello world\n"
Ruby is cleaner than Perl, and more object-oriented than Python. No whitespace nonsense, no @$; stuff either.
Granted, Perl has a much bigger support base, but that's a function of age, not the language itself.
Ruby might not be for everyone, but it's worth checking out if you haven't:
Ruby page:
http://www.ruby-lang.org/en/
IBM's approving review:
http://www-106.ibm.com/developerworks/library/r
(I'm to lazy to put things into HTML at the moment)
One of the really, really nice things about Python is the embedding interface. It's really easy to embed Python in your C/C++ code. It's also a very stable interface.
Anybody who has ever worked with XS will know what I mean!
-Dom
While there are certainly differences between 5.004 and 5.6, they are not all that substantial for many scripts (the main annoyance is that you can't update a 5.004 based MacPerl to the latest libraries).
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"'
As an experienced programmer, I would suggest that you consider which "fundamentals" you'll learn from C. Yes, you'll (have to) learn about explicit memory management and pointer arithmetic. You'll learn all about declaring variables and go crazy casting pointers-to-void to pointers-to-pointers-to-float. None of these things will make you a good programmer.
;-), but learn Python first. You won't be sorry.
The truth is you'll be much better served by learning about algorithms and data structures, so that you know what the hell you're doing with all of those bloody pointers. The ease with which you can implement advanced data structures and algorithms in Python is what makes it a fantastic first language. The interactive Python prompt makes it easy for beginners to try out code quickly and find out what works. And nothing keeps a beginner's motivation strong like writing a working program with a modern GUI using a few dozen lines of code.
Your friend may think that he's doing you a favor by making you suffer like he did when he learned to program, but just because you're suffering doesn't mean you're learning something useful. I can ask you to do your math homework in binary, and you'll suffer, but you won't know anything more fundamental about math than the rest of us. Your friend is the same sort of person who used to grumble about the bad habits of programmers who used *compiled* programming languages instead of assembly. The times they are a changing...
C is a last resort, a lowest common denominator, not the pinnacle of programming languages. It's the tool that wise programmers turn to when their high-level language of choice just isn't quite fast enough, not the language that allows them to be most expressive and productive.
Learn Python. Learn C too (you'll need it for writing Python extension modules
-DA
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.
perl -e 'fork||print for split//,"hahahaha"'
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
Clearly you've not seen APL.
And therein lies the problem: there are so many ways to do things in perl that often only the author can understand them -- this is called a feature? Hate to bring it up, but out there in the real world most people have to maintain code that may or may not be their own. If only the author can understand it, it is not/not maintainable. It costs an enormous amount of money to maintain software -- even more if no one can understand what was written. This may be fine if you never leave your job, but since the average job only lasts 2.4 years now, it creates alot of havoc and expense. Python is not the panacea for everything, but it does do very well for many things. I have been using it for a year now, precisely because I found an old perl script that I wrote that I couldn't even follow anymore. Time is money, and I can do more and be more effective in a language that prevents that sort of difficulty. -- "A towel is about the most massively useful thing an interstellar hitchhiker can have"
Would you care for a jelly baby?
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
Or for the example given (printing the evens from 0 to 8) you could use:
map { print $_*2 } (0..4);
and just ignore the returned list. One advantage of Perl that I haven't seen anyone here mention is that it lets you do a lot of things using implicit loops by operating in list context. Things like:
print join("\n", reverse sort grep {/man$/i} values %names);
look really nasty to somebody who's not familiar with the idiom, but trying to do the same thing using explicit loops would not make the code any simpler or more maintainable.
There's no point in questioning authority if you aren't going to listen to the answers.
For god's sake, don't switch to Python! It sounds like Perl is perfect for you. You like irregularity and context sensitivity, and you seem to think that the unreadability of mathematics somehow validates the unreadability of Perl. You'd hate Python. You'd have to waste all that brain space that you currently use to store the 15 different ways to print to stdout remembering things like the most efficient algorithms and data structures for a given coding problem.
Those of us who are "too stupid to understand Perl" will try to get by without you. (snicker)
-DA
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"'
Oh, I'd sacrifice half my karma to mod this one up.
Thank you!
--
Libertarianism is rich wolves and poor sheep playing gambler's ruin for dinner.
Oddly enough, this is what makes *me* mad about a whole lot of Python programmers: they have learned to program with it, or switched to it, and are now viciously attacking other languages - and in Particular Perl.
... then I suggest you *go back* and learn the skill of programming.
The old saying that "A good programmer can write Fortran in any language" still holds - if you have learned the foundamental skills, it really doesn't matter all that much for your work what language you choose. It may, on the other hand, matter for the efficiency of the final product.
THE most voiced complain about Perl is that "Perl code is hard to maintain" or "Perl code is impossible to read!"
If these are arguments anyone wish to use on Perl, then - for *ONCE* - ask yourself why you would want to write unreadable or unmaintainable Perl code. If your answer to that would be "I wouldn't, but Perl forces me to!"
You can write Fortran in any language - you can mess up Perl just as well as you can mess up Python.
Again and again it seems to *me* that people are not trying to objectively review the differences between the languages - and the Python crowd is just as bad as you claim the Perl people to be.
PS: Yes, I've tried Python. I didn't like it.
JAPH
DTD did the job on me
1. I got some Perl books for free.
2. My friends use Perl, and I can look at and learn from their code.
3. I can easily find other short little Perl programs to look at and modify.
Yes, I am just learning how to program. Yes, these may not bet the best reasons to choose a progaming language, yes Python may be better at some things than Perl, no I am not saying that all Python programers are the spawn of the devil, or that everyone who uses Perl is a saint, it just ends up that it's what works for me. If Python works best for you, GO FOR IT. If not, fine.
"Giving money and power to government is like giving whiskey and car keys to teenage boys" P. J. O'Rourke
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"'
I am really surprised that nobody responded to this message yet.
All the things you are mentioning here are altready implemented (and has more advanced versions: compare SWIG and XS) in perl. The only exception is JPython. There is JPL which achieve a similar objective, but it is not an implementation of perl in pure Java, but I think that is fine. There are a thousand extra modules in perl which make up for it.
Inline module in perl is really nice. You can embed C, C++ and python code inside your perl code. It automatically compiles inline C code and if you didn't modify the C part, it doesn't recompile it. So you have interpreted C pretty much.
>> The trick is to use a decent editor which has good syntax highlighting
>And install it on every last machine you will ever find yourself editing code from, in every environment you could possibly use...
Yeah, it's a real challenge to find a platform that runs either vi or emacs.
If you want to criticize Python at least find a *real* problem with the language and don't just spread FUD about whitespace.
-DA
First off, I'd like to call you an idiot. As many posters before me have mentioned, you could have just used the range operator! And using the -w along with "use strict" flag will flag it as an error. The whole thing with Perl is its flexibility. I don't know about you but to me, the greatest achievement is having one of my programs used in a way I have never imagined. I guess this could carry over with programming languages too. Consider the following endless loop:
How would you replicate this in Python? In this situation, the author's forgot the whole essence of the loop, which was "start with this", "make sure this is true in each loop", and "perform this before each loop". This was all forgotten when the Python designers all assumed that we just wanted to increment/decrement variables (or perhaps they love Pascal too much).
And of course the main thing...readability. You all brag on and on about how readable Python is and how ugly Perl is. Probably because Perl uses typical shell script symbols to denote various objects but in the end, isn't it nice to be able to tell the type of a variable just in the name? Sure we could use prefixes and such, but you were just commenting on how good Python is because it enforces a good thing in white space! And on that topic, sure python forces you to use whitespace and that's a good thing. But it's not like Perl forces you not to! You could use whitespace any which way you want, and in the end, it is up to the programmer to make the code pretty. And who's to decide how whitespace should be formatted? I personally despise C-style formatting (2 spaces + _ rather than caps) and prefer the whole C++ and Java deal, and my Perl code reflects that. But I know many programmers who are the exact opposite, and I respect that. To each his own...and nobody should go out there to enforce one or the other.
And one more thing Python can't compare to...when's the last time you've seen a Python obfusciation contest? That's right...suck that down and weep bitch!
That's because Perl's OO used Python's as a model, so of course they're similar.
The only python I know...is a snake...
-----
GeekWares - Buy and Download Today!
All your Python belong to... aw, f*ck it.
Yahoo owns eGroup now, so it's the biggest portal & email list site, and the biggest search engine... And didn't Yahoo say they wanted to use Google as their search engine? All those great Python apps are clumping together! :)
--
Peace,
Lord Omlette
ICQ# 77863057
[o]_O
For the curious, in perl6 you will be able to write perl in python style, or in many other styles. No more stuck with the good old perl brackets? I will continue to write my programs in perl style which is the best.
"You like irregularity and context sensitivity..."
Yes, this is called efficiency. It has to do with the idea that computers are tools and meant to conserve human time.
"...and you seem to think that the unreadability of mathematics somehow validates the unreadability of Perl"
In the sense that both are hard to read by people who don't know the language and problem space, yes. Math works quite well while being obscure to novices, as does perl. Of course, just as there's baby math, there's baby Perl, and both are quite useful, too. The analogy is actually pretty good. They're both powerful tools to get a lot of work done.
"You'd have to waste all that brain space that you currently use to store the 15 different ways to print to stdout remembering things like the most efficient algorithms and data structures for a given coding problem."
Wow, you actually memorize algorithms rather than putting them into a library or having a reference implementation? This explains why you're using python. Intelligent people actually try to make use of the resources available to them, like packages and copy-and-paste functions. As well, we tend to keep reference books handy.
As for the "fifteen ways to print to stdout", you can use print, printf, write, and syswrite (I'm not counting silly stuff like system("echo $real_message"), or `printf "$real_message\n"`). First off, that's 4 rather than fifteen, but they're also just the methods of writing to a file handle which also happen to work for standard out. Does python really only have one way to write data to a filehandle? It's even stupider than I thought.
"Those of us who are 'too stupid to understand Perl' will try to get by without you. (snicker)"
Don't worry, it won't be difficult. There are all sorts of programs to help people like you. A friend of mine worked in a very nice summer camp called "Clover Patch" and they'll be happy to help you when you take your clothes off during dinner because you confused that context with the context of showering.
I'm curious, though. With your difficulties in dealing with multiple contexts, how do you manage to speak english? And wouldn't you like esperanto better since there are no irregular verbs or nouns in esperanto? Really, with your love of mindless consistency, one would think that you'd have made the switch a while ago.
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
That must be the first time the lameness filter actually filtered junk!
:-P
seriously, that lameness filter has pissed me off so many times (ever spend 15 minutes drawing ascii art to illustrate a point and then
Yeah - unlike perl, C, C++ or Java, where one brace will flatten it instead. Decent editor support makes this a non-issue (see emacs, editplus, probably vim and likely Scintilla).
At least the structure is clean enough that editors can parse it successfully, unlike perl in particular, where I have yet to see an editor that handles and font-locks all perl code including here-documents successfully.
For what it's worth Perl is my language of choice for most things that I don't need to distribute, but I did look beyond the indentation of Python.
"don't fall into the fallacy of believing that Perl can solve social problems. Maybe Perl 6 can, but that's a ways off"
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?
Sign me up baby! I went out, bought a book (just to see what all the talk about Python was), read the first couple chapters, and returned the book as I realized that the whitespace thing was too much for me. I you like python, try ada, pascal with objects... Any of the languages that are considered "good for education/learning because of...." but suck when you try to use them (except to the people who have bought in to the particular language who then LOVE then language)
Um... because that code doesn't scale? What if you want to add things to the loop; do you want to add the mod 2 code to it each time? And I find that rarely do people use the mod operator; they have to look it up. And it is slightly inefficient to boot... you listed a trivial case, so I won't use this as the main argument, but programming like that leads to serious deficiencies. I don't think the lesson should be that trying to program clearly is going against the grain of the language.
Jeez, I used to think you /.ers were kinda cool with your crazy Linux rantings, but after using Linux in the workplace for a year and then going back to Windows, I LOVE it. But hey, thats because I need to use actual applications rather than just jerk off about how cool free software is. I use MS Visual C++ everyday (I'm a games and DB programmer) and it is cool. The only thing that sucks under MSVC++ is the resource editor. I'd much rather define all my resources by hand, thank you so very much MS.
The moral of this story is: Just because MS made it, don't make it automatically bad.
However, I'd switch to an all Linux machine if:
1. A Linux style version of DirectX was available.
2. The graphics drivers didn't suck.
3. The GUI programming routines didn't suck.
Standardisation, people, thats what I want. I like Linux AND Windows. I just don't want to be a little Linux Zealot intellectually masturbating about how cool Linux is and how much MS sucks. Lifes too fucking short. At the end of the day, Windows does what I want. Linux (at the mo) doesn't. End of story. ...Hippies :)
Tron Software -= Kickin' Butt and Writin' Code =-
The reason I stuck with learning python was the newsgroup comp.lang.python . If I din't understand something people would actually be helpful with a real answer. I tried that with perl and the response you get is RTFM. Well I RTFM and I still had quetions at least with the python people you get help.
"Yes, an algorithm that takes twice as long is still of the same order. However, saying that "it is not substantially less efficient" is incredibly stupid.
"
Ok, you have no real idea of proportions when it comes to efficiency, do you? The difference between n and 2n is insignificant compared to the difference between n and n^2, n^3, 2^n, or even n!, all of which are quite real execution speeds encountered in real algorithms. Yes, 2n is not substantially less efficient than n. And when you get to optimized compilers, branch prediction, speculative execution, and 4+ execution pipes, it's quite possible that the difference between n and 2n won't even be that big.
As an example,
for(i = 0; i n; i++) {
array[i]++;
}
Is going to execute in 3n time without bounds checking (2 additions, one dereference). With bounds checking, it would execute in 5n time (we've added two comparisons to each iteration). However, with modern processors, the cost of the bounds checking can be made to be virtually negligible (when you get to generate the optimized assembly). Modern processors are interesting things.
"The 'for($i = 0; $i = 10; $i += 2) { etc. }' is the perl example the original poster gave. The poster that was accused of writing crappy perl? Remember him?"
No, he was accused of writing ugly perl. That's a matter of taste, and I disagree, but the original author was talking about optimizing for textual beauty. I do like "for (0,2,4,6,8) { print; }" much better if all you're talking about is aesthetic qualities. However, in general it's better for code to be efficient hence the C-like syntax. The alternative "for (0..$n) { next if $n % 2; stuff; }" is reasonably pretty. If you don't like multiplication map {print $_ + $_ } (0..$n); is reasonably pretty, though personally I would prefer some sort of for construct. And of course you could always write something to emulate the python syntax, if you really feel like it. Perl is quite flexible this way.
"Is an example of the crappiness python programmers won't deign using."
Interesting. The part where I said, "As an aside, for another pointless alternative..." didn't give you the impression that I wasn't presenting it as a good idea?
"IF and only IF you are incredibly stupid."
What, do you think that you won't see silly stuff like this in python, especially if python ever becomes popular?
"What you are doing is python advocacy, regardless of what you prefer."
Is this your sig, or something meant to refer to me? I ask because it's at the very bottom of your post, as a sig would be, and sounds like something that could (theoretically) be a sig. I just want to make sure before responding, just in case this isn't the ad-hominin attack that it looks like.
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
I think the killer app in this space (open source scripting language-based news/content management systems) is really PHPNuke, which is adding new users on a daily basis.
sig: BeanShell: lightweight scripting for Ja
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.
This is a good point. Sometimes putting a whole bunch of operations on one line describes a single thought, which is nice to have on one line. Anyhow, this reminds me of the end of Chapter 1 in Programming Perl:
print reverse sort map {lc} keys \%hash;
That takes the keys of %hash and returns them to the map function, which lowercases all the keys by applying the lc operator to each of them, and passes them to the sort function, which sorts them, and passes them to the reverse function, which reverse the order of the list elements, and passes them to the print function, which prints them.
As you can see, that's much easier to describe in Perl than in English.
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
I'm of the opinion that all the interviews that he gives suck. He comes off as a arrogant asshole who came up with something and is huckstering constantly. Most of the interviews come off as Python will save the world from Perl (which really sucks!!!), not about how Python will help (other than obvious OOP, whitespace, stalanist protection from yourself) real programmers. It always sounds like the interviewer has been interviewing a sales brochure.
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.
Remind me never to work with you. And I'ld also like to hear how much you opinions on this topic change after you've spent a year or so maintaining someone else's code.
If you're working for an employer, you have a responsibility to make your code as easy to read as possible, which means following their coding standards. And if you don't like them, you can quit. If you're working on an open source project, you have a responsibility to make your code as easy to read as possible, which means making it look just like the other code in the project. And if you don't like it, you can quit. The place I'm currently working doesn't have a coding standard, which is one of the reasons I'm quitting. Every time I need to modify a class or method that I didn't write, it takes me twice as long as it should, because nothing is consistant in the project. And it's because of people like you, who value programming freedom more than ease of maintenance. Or, in other words, freedom to create more than freedom to modify.
When all I did was create code, I used Perl. Now that I've grown up (only a little, or I wouldn't bother to reply to this post), I find myself using other people's code more, and thus I greatly appreciate a language that doesn't go out of its way to be hard to read.
One of the best arguments for using Perl I've ever heard was "Perl forces you to program with good style, Python merely doesn't allow you to program with bad style." Or, it would be an argument for using Perl if I thought that people didn't suck. Since they do, it's an argument for using Python.
I do. Because if my interpreter doesn't trust me, then it also doesn't trust the idiot beside me. And that seems to me to be the ultimate in friendly environments. (Down the other road lies Visual Basic.)
Later,
Blake.
I have to say that was unusually aggressive language advocacy from Guido von Rossum. I would rather donate a kidney than use Perl but to me the Python / Perl split is a classic elegant / baroque dichotomy, of the type that recur over and over again where software is concerned. Some people like the simplicity of one way to do things. Others crave the expressive power of "More Than One" and many features. Examples: vi / emacs, original Pascal / Ada, maybe Java / C++ .
"Python is used pretty much across the board, much more across the board than Perl." - Guido van Rossum
Credibility dump in progress - article reading aborted
The problem with this is the obvious circular-reference problem, where an entire network of objects is self-referring, but the network is cut loose and should be collected.
This is fine (and simple) when it's just a collection of scripts which run pretty quickly, but in the context of something like Zope where the program's more of a server and runs for days, this is going to present serious memory-management headaches.
Ryan T. Sammartino
Ryan T. Sammartino
"Ancora imparo"
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.
I've had some experience with using both languages in some game programming: Q2Java which merges Quake2 and Java, and QWPython, which merges QuakeWorld with Python (and uses a QuakeC->Python translator).
I can say that writing hybrid Java/C code and getting it to run across multiple platorms was a nightmare compared to getting Python/C running on multiple boxes. Q2Java on Linux barely worked, and I'm not sure if it still works with current JVMs, but QWPython even can build on both Win32 and FreeBSD platforms with the same distutils setup file (Python distutils rocks! - no makefile required!).
To be fair to Java though, Q2Java was embedding a JVM in another program, while QWPython was extending Python - a much simpler prospect. But I can attest that Python is no slouch in the portability department, and at least for game programming is very convenient. I have a hard time imagining writing quake-type game logic in Perl.
Guido: Python is better than Perl.
Larry: OK
Guido: PYTHON is BETTER than PERL!
Larry: If you say so, OK. There's more than one way to do it.
Guido: PYTHON IS BETTER THAN PERL!
Larry: Guido, I'm going to go over there and drink some water.
Guido: PYTHON IS BETTER THAN PERL! Listen to me! Perl is write once read never. Everyone is using it!
Larry to Tom and Randal: What is up with that guy?
Guido: Pyhton, Python, lumberjacks and twits... ahhhh he wouldn't have written ahhhh, maybe he was dictating look at the bones...
It's a very good idea to start a flame war between two free languages.
---
This
...and just as newsworthy....
Larry Wall thinks Perl is pretty cool.
NO CARRIER
Given a choice between Perl and Python, I'd choose Ruby.
Well, to get the mod 2 bit out of the block, you could write:
for (grep { $_ % 2 == 0 }, @array) { blah }
perl -e 'fork||print for split//,"hahahaha"'
Not to bash Python, but you haven't talked to anybody who has tried to port Zope from 1.5.2 to 2.0.
After a number of fits and starts, I gave up trying.
The earlier poster is right; Python suffers from lack of an exact specification of the language. Pointing to other languages who share the problem doesn't make it go away.
And I love Python! I'm just not fanatical enough to think it can't get better.
The Web is like Usenet, but
the elephants are untrained.
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
Suggestion for Poll:
How many times this week will we post articles dead set on starting programming language flame wars?
*) One
*) Two
*) Five
*) Cowboy Neal
Seriously... this article is good, but it's going to pissoff the perl-bigot trolls. I hope no one spoils this one with intellegent posts. It's much more fun to watch the trolls flame languages.
-EvilMonkeyNinja
a.k.a. Joseph Nicholas Yarbrough
Security Grunt by Day
Programmer by Night
-EvilMonkeyNinja
Mild Mannered Host by Day
Wild Hammered Programmer by Night
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
(A) I didn't say that popular == good. I said that popular == popular. Now, if you want to get to goodness, it's rather difficult to decide because they're functionally equivalent. I would say, though, that python's avoidance of punctuation simply makes life more difficult in parsing python as you have to read it to know what part you're in.
(B) I never claimed that a loop evaluated with %n in front of it is as efficient as a loop executed the correct number of times, though bear in mind that they're both O(n), so even if someone went with that bizarre method, it still wouldn't be substantially less efficient.
I would simply do
for($i = 0; $i = 10; $i += 2) { etc. }
Which is functionally equivalent, takes only slightly more typing, and doesn't involve some bizarre range function.
As an aside, for another pointless alternative, you could do
for (map {$_ *= 2} 0..5) { etc. }
Why you would do it this way, I don't know, but I rarely use the map function so it's neat to see it in use.
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
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.
"what do you do if you spend 70% of your time reading other people's code, and maintaining it ?"
Learn to be flexible. You're going to have to be regardless of language. Python is not a magic bullet, and it's not going to make everyone use all of the standard tools properly instead of re-inventing the wheel. Python isn't going to stop people from writing convoluted code using unintuitive and inefficient algorithms.
With Perl, the maintainability problem is that you have to actually know the language to efficiently read other people's code. This is quite like a natural language - you can know very little and ask where the bathroom is, but if you want to read a novel in a foreign language, you're going to actually have to know it.
I don't consider this a problem - I've spent the time to learn Perl. I can write clean programs very quickly, and I can read other people's programs quickly. Believe me, as the perl guy around here, I have to debug everyone else's code from time to time when they get stuck. It's really not hard.
Now, I frankly dislike many of the code snippets of python that I've seen around and think that they're actually less clear than the equivalent perl code. Readability really is largely a matter of what you're used to. And if you really need everything to be formatted with precise whitespace rules, you can write a fairly simple perl script to reformat the code for you, so you never have to see the original whitespacing. There was a reason that people invented ident for C.
As for coding standards, these can never really be defined by a language. You're going to have to have the programmers agree on what libraries/packages to use, etc. To give one example of a maintainability headache: Some programmer decides that he doesn't like the agreed upon function, so he writes his own and uses his version.
No programming language is going to solve that problem.
Another huge problem: people not commenting their code. I find comment blocks which quickly give a description of what's going on in the next few lines to be extremely helpful for navigating source so that I don't have to actually read the code until I find the place that I want. Some people I know don't actually comment their code at all, or when they do, they use useless comments and don't provide the useful ones.
(Btw, it's funny when you look through python code and see comments like "# end while text" and "# end for text in lines". So what whitespace significance has achieved is that programmers have to say where blocks end, rather than having a } and an editor which will print out the line that the matching { is on.)
No language can force programmers to write useful comments, or to keep them updated. No language is going to force people to use efficient, or even sane, algorithms for what they're doing. No language is going to be able to enforce standard data storage methods, or formats. Basically, no language is going to be able to enforce (or even strongly encourage) what makes up the bulk of good coding and good coding style.
So if you spend your time reading other people's code, get used to being flexible. It's inevitable (unless you're in the happy situation of working exclusively with highly skilled programmers who never have bad days).
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
"So you optimize 20% of the time, and make a nightmare of the 80% remaining."
... and you'll get all the print statements"
This is just plain wrong. Reading verbose writing is no more efficient than writing it. haven't you ever read an author (in english or some other language) which took forever to get to their point? That's not efficient at all. Taking 5 lines to do what you can do in 1 is no faster to read than it is to write (everything here is assuming that you've got someone who writes clean code, not someone who takes pride in obfuscating what they're doing or just doesn't care).
As someone else said in a different thread, you wouldn't make
print reverse sort map {lc} keys %hash;
Is no more readable or maintainable if you write it out on multiple lines with intermediate variables.
"Magic $_ is not a powerful concept, it's just a shortcut making you win 1 second (and that might cost the maintenance programmer 1 hour)"
This is again just nonsense.
for (@array) { print; }
Isn't obscure because it uses $_.
for (@array) {
s/Foo/foo/g;
s/Fie/fie/g;
s/fred/john/g;
s/Greg/Gregory/g;
etc.
print;
}
Is just as readable and maintainable as
for my $tmp (@array) {
$tmp =~ s/Foo/foo/g;
$tmp =~ s/Fie/fie/g;
$tmp =~ s/fred/john/g;
$tmp =~ s/Greg/Gregory/g;
etc.
print $tmp;
}
Once you get used to the syntax of nothing being synonymous with $_, you read it just like you'd read it with a variable being there, except that you have to read fewer characters.
Also, once you get used to the language, using $_ has a slightly different feel than using a $tmp, so experienced programmers can actually use the difference in nuance to make the code more readable.
"'sys.stdout=my_object_with_write_method'
open(STDOUT, ">&FILEHANDLE") will do basically the same thing.
Now, admittedly, if you need to reformat all of the text going to wherever you want to redirect it to, this method won't work and you'd probably have to resort to something like redirecting to a pipe that leads back to the same program which then does the reformating (just off the top of my head).
To be honest, why this isn't as clean as the python method, what i'd probably do (having given it 60 seconds thought) is to redirect STDIN and STDOUT to pipes and fork off another process which then reads from and writes to these pipes, converting the input and output as appropriate. Since what you're talking about is a hack situation, I don't think that it's really that bad to answer it with a hack.
Of course, if you actually anticipate this need, just roll your own read and print functions and use them instead.
"The humain brain can handle ~7 things at a time ; I rather not overload mine with cretinuous syntaxes issues designed to save one character, and be efficient and productive."
~7, did you mean approximately, did you mean logical complement, bitwise negation? Hm. Context is important here. was ; an english punctuation mark, was it a termination-of-statement character? Context is important, too.
hell, how do I know if you're writing out a perl program or using english? is the , an argument separation character, or a syntactical pause in the sentence? Is "be" a command or is "be" a future-looking verb (in the subjunctive? -- it's been too long since I've done grammar.)
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
"You are a computer scientist, right ... considering it costs nothing to make it go twice faster."
This depends on whether you're talking theoretically or practically. Of course as a practical matter you want to squeeze as much speed as you can out of your code, though this has to be balanced with other things. The exact efficiency of a loop which is going from 1-10 is basically completely irrelevant. Now for large n, if you're looking for speedups, while this would be a quick win, you'd do better to look for code with real inefficiencies (i.e. O(n^2), O(2^n), etc.).
As an example, why are you printing out n statements for large n? If you summarized, you'd have amazing speed improvements. As an example, given modern hardware and such, you'd be amazed at how much of a speed increase you can get from updating the status every 10 times through a loop rather than every time through.
In our fabricated example, print statements take up enormous amounts of time compared to modulus operators. You might get a much bigger win out of:
$t = ($n%2)?($n-1):($n);
for(0..$n) {
next if $_ % 2;
if(!$_ % 256 || $_ == $t) {
print join("\n", @list);
undef @list;
}
push(@list, $_);
}
Is actually slightly faster than the simply $i += 2 version, and twice as fast if $n is known to be a multiple of 256 and thus you can drop the || $_ == $t (by benchmarking). While this is not the most efficient version, this should illustrate that efficiency is a very tricky thing, often.
Anyhow, this is only for large n. For small n and with the optimization goal being beauty rather than CPU efficiency, I like some of the perl ways better.
"But oh, python has the same nifty feature... but I can tell you it *is* used often, where it makes sense."
Actually, I suspect that map isn't used that often because usually you can simply be consistent rather than needing to map between two things. When you can't be consistent, I suspect that it's probably a tossup between map {} and explicit for loops.
Now, it's kind of odd if you actually need this functionality in python often, because I rarely need it in perl.
"So maybe python is not such a straitjacket, um?"
Python isn't such a straightjacket because you need map{} a lot in python, or because there's no habit among python programmers to play the game of "how many substantially different ways can I write the same thing" (on slashdot, at least)? I honestly don't see what there being a map function has to do with python being a straitjacket, or that in real code people only use it where appropriate (just like perl people only use it where appropriate in *real* code).
"Also, you dare say that efficiency of code depends on syntax????? Are you nuts?"
Ok, it's quite simple. Tools are made for purposes. If you use some tool for a different purpose than it was meant, it will often not be as efficient as the appropriate tool. The range operator is meant to provide a contiguous range. Consequently it's less efficient at providing non-contiguous ranges. The c-like syntax is meant to be as flexible as possible (i.e. makes as few assumptions as possible), consequently, when you're using it for something that no other operator was optimized for, it won't have assumptions that get in your way.
"It is not ad hominem"
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
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
The following link is to an empirical comparison of a number of scripting and compiled languages. Interesting reading as it takes into account issues such as program lenght, reliability, memory consumption amongst other metrics:
Ruby is similar to perl and python in many ways, but brings its own interesting ideas to the table. I find it to be a happy middle ground between perl and python. It's a truly object-oriented language, unlike perl or python, and comes ready for real work with a debugger, profiler, interactive shell and bindings for ldap, snmp, and mysql and postgres. Have a look at the ruby website. Rumor has is that an O'Reilly book is in the works.
"Remind me never to work with you."
With pleasure. I dislike working with completely inflexible people.
"And I'ld also like to hear how much you opinions on this topic change after you've spent a year or so maintaining someone else's code."
My opinion that people should write good, clean code, but should also be able to use their own definition of good and clean won't change, I can assure you. Sure, everyone standardizing on one coding style would be nice, just like everyone using English and everyone having the same religion would be nice. But when you get down to it, after we've each killed each other because we can't agree on the coding style, very little code will get written. Consequently, let's agree to disagree and not work on the same project as we've already agreed to.
"[various stuff about consistency]"
Of course projects should be consistent, and people should write good code. I never argued any other way. I just argue that people should be able to quit a project and find one that they like better. With python, that isn't nearly as much of an option. You don't have much choice in how you code or what your code looks like. Maybe I like code that guido van rossum would hate. Should I therefore not be allowed to have my own project?
"And it's because of people like you, who value programming freedom more than ease of maintenance. Or, in other words, freedom to create more than freedom to modify."
Good code should be relatively easy to maintain. I don't think that any sane person would argue otherwise. On the other hand, it's kind of silly to say that one's code should be an absolute bitch to write so that it can also be an absolute bitch to maintain, but at least equally bad in both cases. I'd much rather have code that's easy to write and to maintain.
"When all I did was create code, I used Perl. Now that I've grown up (only a little, or I wouldn't bother to reply to this post), I find myself using other people's code more, and thus I greatly appreciate a language that doesn't go out of its way to be hard to read."
Perl doesn't go out of its way to be hard to read. Perl goes out of its way to be easy to write. If you know perl, it's also easy to read. However, it must be noted that since Perl is much more popular than python is, Perl also has far more incompetant programmers than python does, and not just in proportion. Why are there fewer completely incompetent people using linux? It's not because of magical qualities of linux - right now there are selective factors which weed out the technically incompetent. These factors will eventually go away and the balance will be restored.
So too with python. Eventually it will get popular enough that people who don't know how to program will start learning with production python code and debugging your average python script will be as bad as debugging your average perl script. C++ is a good example of this in languages.
"One of the best arguments for using Perl I've ever heard was 'Perl forces you to program with good style, Python merely doesn't allow you to program with bad style.' Or, it would be an argument for using Perl if I thought that people didn't suck. Since they do, it's an argument for using Python."
Now we come to our fundamental difference: you think people are idiots and can't be trusted with their own code and I don't. You are, of course, free to hold your opinion. Just please be honest about it. Don't talk about Python being a cleaner language, talk about Perl letting people be the idiots that they naturally are. Btw, do you think that the rest of the python community are as misanthropic and elitist as you are? That's one of the best parts of the perl community - it tends to be made up of nice people.
>> Who wants to trust an interpreter which doesn't trust them?
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
Symbolic references for variables and functions: I.e
$var = "temperature" ;
. . .
$$var = 5;
print $temperature; # Prints 5
or
$sort_func = "sort_ascending" ;
....
&$sort_func(@lst) ; # Calls sub sort_ascending()
This can also be done with eval but symbolic expressions are much more efficient.
Have functions like "pack", "unpack" and bit shift operators? "pack" takes a list of values and then packs that data into a binary sructure. And of course "unpack" is the reverse. Good for efficient reading and writing of binary files and things like one line conversion of binary streams from big endian to little endian conversion.
Fast built in reg expression. Single line of reg expression often replaces pages of code and the code is optimize for efficient parsing.
BEGIN and END function blocks of code that run before compilation and after when the interpreter is being existed. I often include the following for keeping track of execution time.
BEGIN {
$start_real = time ; # Start timer
}
END {
$stop_real = time ; # Stop timer
$diff_real = $stop_real - $start_real ;
print $diff ;
}
Cool (and fast) built ins like "grep", "sort", "map", "chomp" , "split", "join"
Very few and far between. Like striking gold. One small thing makes an enormous difference. ;)
The term started, I think, with the spreadsheet. For context, imagine using a text-based spreadsheet on an 8086-based pc versus trying to get the mainframe programmers to accomplish the same thing in COBOL. "Everybody" is trying to find the next one. Lotsa luck
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.
Just to throw in my 2 cents, compare a medium complicated regular expression with the same thing written in plain understandable English. Now imagine you have to write and later read a lot of them.
For documentation that actually helps, the best I've found are listing the inputs and the outputs with a brief indication of the function.
Is 10 printed?
Perl Example?
Python Example?
Watch those endpoints!
I've seen some passion. Bordering on rage.
push(@ISA,'MixinClass');
I am with you. Too much hype about the snake.
;-))
Perl will definitely remain the first scripting languages for at least 2-3 years to come.
And if I were to find an alternative to Perl, and a REAL OOP scripting language, I would choose Ruby, not Python, where
OOP has not gone too far from that of Perl.
__END__
__END__
Sevast...
So writing in a (true) RISC assembly is guaranteed to produce the most bug-free code?
No, better yet, the perfect code would be written in assembly on the 1-op-code CPU, right?
Complexity isn't evil. It really isn't.
And why are you speaking english rather than esperanto, since english is much more complicated and irregular than esperanto?
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
He said, "Forget it. Go back to C. Weakly typed languages like Python and Perl allow you to get away with a lot of sloppy coding. If you learn with a ballbuster like C, you don't have to unlearn bad habits later on."
Just two months later, I agree with him. I've learned an awful lot because I've had to wrestle with C. I'm not sure that I would understand the fundamentals as well with a high level language like Python, and the only way to become a wizard is to know the fundamentals. I'm still new at this though, so take this with a grain of salt.
This
.. it's so portable, it will even run under perl - Inline::Python ;-)
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.
"It's unnecessary complexity which is evil."
So you never use contractions or pronouns?
They laughed at Einstein. They laughed at the Wright Brothers. But they also laughed at Bozo the Clown. -- C. Sagan
Why not go read Guido's tutorial (which IMHO is very nicely written and easy to read) and find out for yourself. If you know a few other languages, you can learn Python in a couple of hours.
true, the article is pathetic. I got to the bottom and looked for the standard More or next page and found I waa at the end! sheesh no wonder banner ads make no money.
.oO0Oo.
and that fixed sized text. Here I am at 8am tryig to read the tiny text, not much fun.
FIXED POINT TEXT SIZES SUCK or at least small ones do
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
Python is a very good language to learn programming with. Yes, it's high-level, but that's good in that it allows you to experiment with the logic of algorithm and program design rather than waste time with learning language quirks.
Of course, if you want to get down to the MOST fundamental level of all, you wouldn't be citing C as an example of this - you'd be looking at things like binary, circuits/gates, logic, CPU structure, etc. After you'd studied those and were fully aware of the "fundamentals" of those, you'd move on to assembly language, to find out how to apply programming concepts at almost that level. That would be fundamental. Once you'd done that, then you'd repeat that process with several architectures and THEN you would learn C. That is bit a extreme though, don't you agree? Yes - Python IS a good language to learn programming with, all hyperbole aside. Typechecking is not a difficult concept to deal with after working in weakly typed languages. You won't learn sloppy habits by programming in a language that is weakly typed, and you'll be able to concentrate more on algorithmic design with Python - unlike C, where you'll spend most of the time programming "around the language" - that is to say - the language will get in the way of what you're trying to program, instead of allowing you to program the logic efficiently.Once you have a firm grasp of algorithms, and the mathematics behind good progam design, THEN you have the mindset for programming - this is easy to acheive using Python. Once you have these concepts and methodologies, the pure math side of things - down pat, then yes, move on to C, for it IS more powerful than Python. Your post is full of misconceptions though.
While your co-worker might have good intentions, I don't think that he's right by a long shot."A few atoms won't even light a match" - Dr Jones, 1933
Cryptnotic
My other first post is car post.
"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?
Python is my favorite programming language to date. It all of my favorite features that are in other languages.
For those of you that don't know much about python, I would encourage you to try it out! Coming from the following languages, here is why I would recommend python:
Java - Python has a class library the size of Java's, its VM starts up faster, and its simpler to write and maintain. Plus, it isn't controlled by Sun!
Perl - Okay, all religious issues aside here. Get real. Perl is a great language, but it has largely been extended beyond its original intent, and is straining to keep up. Python is easier to learn, develop in, and most of all *maintain*. If you have ever looked at another person's Perl code and tried to maintain it, you know what I mean. Perl is cool. Python is cooler. Give it a shot, you can even use Perl style regular expressions!
C++ - Still haven't realized that C++ is a dirty hack eh? No, all kidding aside, C++ is also a great language. Honestly though, I struggle to develop quickly in C++ because I keep running into language barriers. C++ is probably the most widely used OO language next to Java. I for one am sick of managing my own memory. Leave it to the garbage collector thanks =) If you want a really really fast OO application, write it in C++. If you want to develop a OO application really really fast -- choose Python.
C - Ahh, the great C. What a fantastic language. Fast, Fast, Fast! But, not object oriented. Now, I know in the Linux world there are a lot of C lovers, and don't get me wrong, C has many uses. But the world would benefit if people would write their apps in Python. There would be very few memory related bugs! Many times, the development cycle is slowed dramatically by C's tragically painful memory management. Programmers are dumb. We really are. We make silly off by 1 errors, that oftentimes can make a C program leak memory like a swiss cheese bucket. Write in Python. Its *so* much easier, and is perfectly fast for GUIs, and many server applications.
Python, to me, is the language of the future. It is fast, easy to lean, fun to develop in, and is just plain cool.
It's a beatiful thing seeing Slashdot incite two language wars in one day, but editor wars deserve equal time. I'm pretty sure that in the last paragraph of this article, Guido called Emacs "just an editor."
The different toolkits I am looking at are
zope vs mason vs arsdigita/openacs vs phpnuke vs jetspeed
This is not a flamebait, but does this choice boil down to
python vs perl vs tcl vs php vs java??
Of these toolkits, which one would be the easiest to get up and going, and still allow you to get funky?
Live today. Tomorrow will cost a lot more!
In Python everything is public. Yeah there can be some problems with this, but it makes learning the language *so* much easier. I can spend my time learning algorithms, not the nuances of a language. Once I've got the algorithm mastered, I can port it fairly easy to another language.
This is why I really like Python. I picked it up really quickly; much faster than any other language I tried. In fact, I picked up a book on it about three weeks ago. Today I completed my first *real* program for work. So in three weeks I learned enough of a language to write a program that'll automatically check a remote FTP site, insure that daily files backed up, and that they're the right size. I don't know many languages that can go from zero to that in three weeks.
So I guess I consider myself to be a bit emotional about Python.
Last night I shot an elephant in my pajamas. How he got in my pajamas I'll never know.
" I'm going to kill 'em all, Sir " - Todd in ' Soldier '
AC comments get piped to
Let me play devil's advocate, Perl-style...
s/Python/Linux/
s/Objective C/NeXTSTep/
s/Perl/Windows/
I really dig Python's for-loop. for x in list: print x Much easier to use!
Last night I shot an elephant in my pajamas. How he got in my pajamas I'll never know.
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.
Objective C isn't going to die. Apple's use of it will hopefully bring some attention to it.
Cryptnotic
My other first post is car post.
The two *don't* compare. The most important feature of Perl is "There are more ways to do it". Imposing a "cleaner programming style" on the programmer is as un-Perl as it gets. I don't know Python, but it's clear that it has completely different goals. Using Perl you can bould your application in your own programming "style". Most Perl scripts may not make much sense to anyone but the author, but that's a feature, not a bug.
But Perl and Python are in the same niche. And Python is not significantly better than Perl. Not significantly enough to change the current state of affairs.
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.
Some of your points are dubious IMHO:
- points 2: Perl and Ruby are also defined by their implementations.
As these languages are still evolving, it seems quite normal!
- points 4: choosing a language is HARD, and while Ruby seems promising, Lisp is not designed to solve the same class of problems IMHO.
I don't know much about the point 1 and the point 3 is quite valid but it is the price to pay to avoid having a language full of cruft..
Anyway, software developers (including myself) love it.
Cryptnotic
My other first post is car post.
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
Bwah!
/.)
You Perl programmers make me mad! You act like Linux versions of VB programmers. Overestimating the depth of your own knowledge.
You have learned to program in Perl and now that you know that you think you know everything about all programming languages.
Funny thing though. There is a LOT of people who have swiched from Perl to Python (myself included), but I have yet to meet someone who volunteerly have switched the other way around.
Please try Python and get to know it before dissing it, or get a marketing job at Microsoft spreading FUD because that's what you are doing now.
(I have nothing against Perl, it's just the know-all attitude of some of the developers that ticks me of. And the fact that their comments get such a high rating on
Max M - IT's Mad Science
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.
I knew someone who was formerly intrigued with Zope. After writing a commercial website with it, it turned out to run like a dog under any real stress. He immediately ported to Cold Fusion. Other things he mentioned was never quite knowing if his code was at fault or Zope's.
Or if you're really impatient try Instant Python and learn it in 10 minutes! ;)
When I initially looked at it I thought, wow this is the language I'm looking for, nice clean syntax, object oriented ... then the idea of significant whitespace, and the wacky way of adressing/splicing arrays, (and goodness knows what other kind of surprises) kind of turned me off.
I've never gotten into using it, but it looks like it would be similar to Perl in functionality, only much prettier ... probably an ideal teaching language (if it weren't for the significant whitespace and whacky array splicing). OK, I'll admit, the significant indentation is probably a way of enforcing both good layout, and modularity (you would not want to be down 8+ deep loops and try to see which indent belonged to whom.) But those arrays?!
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.