Message372582
Originally brought up on StackOverflow, https://stackoverflow.com/questions/60799366/nested-async-comprehension :
This dict comprehension parses and works correctly:
async def bar():
return {
n: await foo(n) for n in [1, 2, 3]
}
But making it nested fails with a SyntaxError:
async def bar():
return {
i: {
n: await foo(n) for n in [1, 2, 3]
} for i in [1,2,3]
}
The error reported is:
File "<stdin>", line 0
SyntaxError: asynchronous comprehension outside of an asynchronous function |
|
Date |
User |
Action |
Args |
2020-06-29 14:50:41 | hniksic | set | recipients:
+ hniksic |
2020-06-29 14:50:41 | hniksic | set | messageid: <1593442241.74.0.468196599971.issue41159@roundup.psfhosted.org> |
2020-06-29 14:50:41 | hniksic | link | issue41159 messages |
2020-06-29 14:50:41 | hniksic | create | |
|