Why python?
linuxjournal.com
linuxjournal.com
I'm looking at his page now, and he appears to have written or contributed to more software since, so I'm not sure if this still applies. I suspect it does, but I'm not ready to pass judgment until I read his more recent essays.
http://news.ycombinator.com/item?id=1822376
http://news.ycombinator.com/item?id=297683
Lots of comments on each. Before commenting here it might be worth reading those earlier discussions.
Readability.
I started learning Python in 2003, I was really a programming newby, by I managed to get my first full-time programming job just 2 years later because Python made it that easy for a neophyte to get from 0 experience to getting paid to write code. List comprehensions are cool, and not that hard to grasp, but I agree, I sort of started losing track once people started using "generator that" or "decorator this" for every damn problem you threw at them.
Problems change, programmers needs change. What was not necessary yesterday, might be very important today. You will have no option but to keep adding on things as they are needed.
I started out with vi, then found out I was better off using emacs. Its rather better to use something designed to be big from the scratch, than to be using some thing invented to be minimal but bloated later just to compete with others.
Python is just undergoing the natural trend.
for i in xrange(1, 10000000000000): print i
and this doesn't: for i in range(1, 10000000000000): print i
To make the range() example run, you have to use generative behavior anyway, in some form or another. Generators are a simple way of expressing that kind of algorithmic behavior.(for the record, this little example is being ran on a machine with 2GB of ram)
I know that is a very silly use case for generators, particularly when range() is going to become xrange() anyways - but it is a perfect example of why generative behavior can make things simpler. The trade off is memory vs computation - range() builds the whole list then iterates over it; xrange() generates the next item in the list; use normal list construction when the list is knowably going to be small, use generative behavior when the list is going to be big!
Decorators make the language less simple????? A decorator gives you the ability to modify a function/class at runtime. Decorators have made my python code (where they are useful) much much simpler!! Decorators have given me another dimension to follow DRY with!! Decorators do make the implementation more complex but they make the code you write simpler - the trade off is very clear and the cons are almost non-existent.
If you think decorators are cool, try picking up Common Lisp or Scheme - Macros will rock your socks off.
There's a danger here: add too many "simplifications" and you get something complex.
(though list comprehensions really are awesome!)
I'm among the few unimpressed by list comprehensions. I use them because they're "idiomatic", but I'm equally comfortable with good old map(), which, I admit, it may be equally foreign for imperative-only programmers.
About the xrange() example, IIRC the iterator protocol predates generators, and probably is easier to grasp since the state is handled explicitely.
Decorators, as Lisp macros, are powerful but, if not handled with care, the source of very subtle bugs, because the thing you're looking at(the decorated function) doesn't do what it seems to do.
Anyway I'm not arguing against this artifacts, just pointing that, some of the merits of Python that were true a decade ago, aren't anymore.
I nitpicked those features because while I would agree list comprehensions aren't as readable/learnable to a new user, they do make the language simpler in that it increases the expressiveness of the language for a common pattern. To each his own, I like both list comprehensions and map() - not sure if I really take a side on either one...
My example of xrange() in arguing for generators was a bad one because you're right, it is an iterator. I still feel like generators increase the expressivity of the language and therefore make it "simpler" - but again I will agree with you that new users will find it less readable and less learnable (to begin with though!).
Decorators I will completely agree, are new user unfriendly and are a complex language feature - I suppose I was arguing for reduced program complexity rather than language simplicity in the context of the decorator addition.
But I've realised that the second half of it is actually quiet interesting and worth a read for people who are thinking about the strengths and weaknesses of different programming languages.
I still have the issue of Linux Journal with this article in it, lying around somewhere. That was ESR's heyday.
Do people really disagree that huge, non-OO scripts were the dominant style back in the 1990's? Or that people tried to solve problems with huge data structures instead of classes? And that these practices gave Perl a less than stellar reputation?
Or is it that people don't realize that Perl apps are virtually always written in clean, well-factored OO these days?
Thank you for clarifying. I appreciate it.
No, not doing it wrong -- he was almost certainly doing it in the predominant style of the language in the 1990's, which was procedural / scripty, e.g., hashes of references to arrays of references etc. Pre-OO.
And his remarks are certainly fair for the time period, but isn't it also fair to note that this style of coding is not practiced anymore? I think so but I'm interested in any viewpoint.
However, it's a manner of how you present the comment. As you originally stated it, it pretty much sounded like "He's Doing It Wrong", which didn't add very much to the discussion. In my opinion, a much better way to go about it would have been something closer to "I think it's worth contextualising his comments. It is likely that the style in which was coding was more in line with earlier styles that are not used as often in 2011. While Perl is obviously still Perl, more recent styles do help alleviate some of his concerns."
Now, this clearly still isn't a perfect comment, but it, or something more like it, would serve both to clarify your position and to allow for discussion based on it, if people were up for such discussions.
But, again, I feel the need to reiterate that I was not one of the people who downvoted you, so I'm only guessing as to the most likely reason for the downvotes.
ESR is apparently saying (true at the time) that Perl can be hard to maintain. But by "Perl," I speculate that he was talking about coding in monolithic non-OO scripts which would be a drag in any language.
So his criticism of the language was fair in the 1990's, but only for that style of procedural coding.
I tried to look at his source, but his own links to his Perl stuff are broken:
I don't know python, but "OO changed all that" implies that data-centric approaches are somehow passé, to which I'd reply "yeah, but FP changed all that". Maybe they are in Python though.
http://www.ibiblio.org/pub/linux/search/keeper-1.54.tar.gz
It's slightly better than what you'd have downloaded from any one of hundreds of "FREE PERL SCRIPT" sites in the late '90s, if only because ESR understood Unix better than most.
Well no wonder he expressed frustration. That would be unwieldy in any language. No disrespect to esr (obviously) because that was a million years ago in Internet time.
Why Python? (2000)