[Python-Dev] PEP 289 - Generator Expressions - Let's Move For ward
Jewett, Jim J
jim.jewett at eds.com
Mon May 3 09:58:01 EDT 2004
Guido van Rossum:
> My counter to that is that *any* use of genexps where the consumer
> doesn't consume (or discard) the iterator before the next line is
> reached is extremely advanced use.
This might be worth putting in the PEP and the docs --
Normal usage of a generator expression is to immediately consume
the entire sequence, or to discard the remainder.
If portions of a generator *are* used later, programmers may need
some extra precautions to ensure that all names still have the
desired bindings.
-jJ
More information about the Python-Dev
mailing list