Nick Coghlan added the comment:

It's a side effect of the hidden closure that provides the new scope for the 
iteration variable - that's an ordinary function object, so using yield or 
yield from turns it into a generator expression instead. Generator expressions 
are already generators, so using yield or yield from just adds more yield 
points beyond the implied ones.

I've never figured out a good way to document it - it's a natural consequence 
of the comprehension's closure. An explicit mention in the reference docs for 
comprehensions may be worth adding.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to