[issue10544] yield expression inside generator expression does nothing

Yury Selivanov report at bugs.python.org
Thu Nov 23 11:42:36 EST 2017


Yury Selivanov <yselivanov at gmail.com> added the comment:

> Well, after all I am thinking maybe it is indeed makes sense to ban `yield` inside both sync/async and both comprehensions/generator expressions.

I agree, as I can't imagine a real use case for

   a = ((yield a) for a in as)

which is really equivalent to

   def a():
      for a in as:
         yield (yield a)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue10544>
_______________________________________


More information about the Python-bugs-list mailing list