22 Nov
2017
22 Nov
'17
8:36 p.m.
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