[Python-Dev] Tricky way of of creating a generator via a comprehension expression (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 22 23:36:30 EST 2017
- Previous message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Next message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Paul Moore wrote:
3. List comprehensions are the same as list(the equivalent generator expression).
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.
-- Greg
- Previous message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Next message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]