Generator expressions v/s list comprehensions

Jacek Generowicz jacek.generowicz at cern.ch
Mon Aug 30 10:52:27 CEST 2004


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> Those features are in other languages for a reason, and there's been
> enough experience using them (in those languages) that their
> desirability for Python should never have seriously been in
> question.

While I feel a lot of sympathy towards this statement in principle,
the other side of the coin is extremely important too. One of Python's
strengths is exactly that it does _not_ import many tried and tested
features from other languages (braces as delimiters, access
restriction, static typing, meaningful line noise, etc.) However, it
is also one of its weaknesses (nested scopes, for example, as you
mentioned). It all depends on the actual feature in question, and the
programmer in question.

> So it would have been better to include them from the beginning,
> instead of through separate episodes of prolonged agony for each
> one.

Python occupies some position in the space of all possible programming
languages. Its position changes, as the language evolves. The language
evolves because the Python community pushes it in some direction that
it considers to be a good one. Judgements about which directions are
good, come from experience with using the language. The language
evolves into one which the community finds more useful, the language
arrives at some local maximum in programming language space. You would
like it to have been placed at the local maximum in the first
place. So would I, but that is not realistically possible.

And remember, the landscape looks very different from different
people's perspectives, what might look like a local maximum to you,
might seem to be in a deep trench from my point of view. Macros,
anyone? Lambda?



More information about the Python-list mailing list