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

Serhiy Storchaka storchaka at gmail.com
Wed Nov 22 13:38:52 EST 2017


22.11.17 17:10, Ivan Levkivskyi пише:
> - fix yield in comprehensions

I'm working on this. I was going to inline the generating function a 
long time ago for small performance benefit, but the benefit looked too 
small for complicating the compiler code. Now I have other reason for 
doing this.

> - await in comprehensions already works

I'm surprised by this. But I don't understand await. If this works, 
maybe it is possible to make working `yield` in generator expressions.

> - make both `yield` and `await` a SyntaxError in generator expressions.

This looks as a temporary solution to me. Ideally we should make this 
working too. But this will be harder.



More information about the Python-Dev mailing list