Zachary Ware <[email protected]> added the comment:
Your async listcomp must also be defined within a coroutine to turn `async`
into a keyword in 3.6. The following is far from best practice (don't do this,
I don't know what I'm doing! :), but at least it compiles and shows that it
works:
async def arange(n):
for i in range(n):
yield i
async def alistcomp():
return [i async for i in arange(10)]
try:
next(alistcomp().__await__())
except StopIteration as e:
value = e.value
print(value)
----------
nosy: +zach.ware
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31832>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com