StopIteration in the if clause of a generator expression

Raymond Hettinger vze4rx4y at verizon.net
Sun Apr 3 08:10:34 EDT 2005


[Peter Otten]
> Do you see any chance that list comprehensions will be redefined as an
> alternative spelling for list(<generator expression>)?

Not likely.  It is possible that the latter spelling would make it possible for
Py3.0. eliminate list comps entirely.  However, they are very popular and
practical, so my bet is that they will live on.

The more likely change is that in Py3.0 list comps will no longer expose the
loop variable outside the loop.


Raymond Hettinger






More information about the Python-list mailing list