[Python-Dev] Tricky way of of creating a generator via a comprehension expression

Antoine Pitrou solipsis at pitrou.net
Thu Nov 23 06:49:28 EST 2017


On Thu, 23 Nov 2017 12:39:46 +0100
Ivan Levkivskyi <levkivskyi at gmail.com> wrote:
> 
> Also I think it makes sense to keep discussion in one place, i.e. either
> here xor at https://bugs.python.org/issue10544

The bug tracker can be used for implementation discussions, but general
language design decisions (such as whether to allow or not a certain
construct) should take place on python-dev.

I'm still in favour of deprecating and then disallowing.  Nobody seems
to have presented a real-world use case that is made significantly
easier by trying to "fix" the current behaviour (as opposed to
spelling the loop explicitly).  I do asynchronous programming using
"yield" every day in may job (because of compatibility requirements
with Python 2) and I've never had once the need to write a "yield"
inside a comprehension or generator expression.

Regards

Antoine.




More information about the Python-Dev mailing list