[Python-Dev] Tricky way of of creating a generator via a comprehension expression
greg.ewing at canterbury.ac.nz
Wed Nov 22 23:36:30 EST 2017
Paul Moore wrote:
> 3. List comprehensions are the same as list(the equivalent generator
I don't think that's ever been quite true -- there have
always been odd cases such as what happens if you
raise StopIteration in list(generator_expression).
To my mind, these equivalences have never been intended
as exact descriptions of the semantics, but just a way
of quickly getting across the general idea. Further
words are needed to pin down all the fine details.
More information about the Python-Dev