On 24/01/2017 21:14, Glyph Lefkowitz wrote:
I've encountered this before and quickly worked around it, but I think
this might actually be a bug in python 3, or at least its documentation.
The language docs officially say that a "list display" (which is what I
believe we're looking at here) "yields a new list object". But that is
not what I see here:
>>> [(yield 1) for x in range(10)]
Related, see:
http://stackoverflow.com/questions/32139885/yield-in-list-comprehensions-and-generator-expressions
http://bugs.python.org/issue10544
Basically, don't use yield inside comprehensions if you don't want
weirdness, AFAICT :o/
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python