[issue32113] Strange behavior with await in a generator expression

2020-07-25 Thread Bryan Hu
Change by Bryan Hu : -- versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32113] Strange behavior with await in a generator expression

2017-11-22 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: A first simple idea that comes to my mind is special-case async generators/iterators in PyObject_GetIter to say something like: TypeError: asynchronous iterable can't be used where an iterable is expected If it is possible to detect

[issue32113] Strange behavior with await in a generator expression

2017-11-22 Thread Yury Selivanov
Yury Selivanov added the comment: > ... result = list(await g(i) for i in range(3)) This is equivalent to this code: async def ait(): for i in range(3): v = await g(i) yield v result = list(ait()) Where 'ait' is an async generator

[issue32113] Strange behavior with await in a generator expression

2017-11-22 Thread Ivan Levkivskyi
New submission from Ivan Levkivskyi : PEP 530 is not very clear about `await` in generator expressions. But when I try it, the error is a bit confusing: >>> async def g(i): ... print(i) ... >>> async def f(): ... result = list(await g(i) for i in range(3)) ...