Generator expressions v/s list comprehensions
Michael J. Fromberger
Michael.J.Fromberger at Clothing.Dartmouth.EDU
Tue Aug 31 01:58:29 CEST 2004
In article <1gjbs1e.assxlxlud1m0N%aleaxit at yahoo.com>,
aleaxit at yahoo.com (Alex Martelli) wrote:
> Mahesh Padmanabhan <mahesh at privacy.net> wrote:
> > I just wish that generator expressions had been designed into the
> > language without going the way of list comprehension -> generator
> > expressions.
> It would sure be nice if Python had been born back from day one with all
> the neat features it has taken years to develop -- that way we wouldn't
> have any issues that are there just because of backwards compatibility.
> Unfortunately, this wish is totally unrealistic -- obviously people do
> come up with cool ideas such as the iterator protocol, and generators,
> after the language has been around for a while.
All the cool features Python has adopted existed a long time before they
made their way into Python itself. As I see it, the real issue with
taking up new language features is that the vast majority of work-a-day
programmers seem to be highly reticent to embrace new tools and ideas,
for one reason or another. I think this explains -- among other things
-- the lingering popularity of languages like BASIC (in its various
incarnations), and Fortran.
In fact, one of the things I love most about Python, both the language
and the community surrounding it, is that here, for the first time, we
see a large community of mainstream programmers who are ready, willing,
and able to adapt to new ideas without losing their heads and retreating
into the ostensibly safe and comfortable world of linear imperative
programming. Instead of insisting everybody forget what they know and
start over, however, Python gives us the old familiar stuff, too, and
the new ideas come in a little at a time.
Frankly, I think if the Lisp world had managed to build the same
friendly and welcoming community Python seems to have, it would have
taken over the world a quarter-century ago.
Michael J. Fromberger | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
More information about the Python-list