Message245931
The following code:
async def foo():
lst = [await coro(i) for i in range(10)]
return lst
gives
SyntaxError: 'await' outside async function
I understand that this is because the comprehensions are implemented using a function scope (see also #10544), but such behavior is unintuitive.
IMO there are two possibilities here:
1) make comprehensions behave more like a for loop;
2) change the exception text to something like "SyntaxError: 'await's in comprehensions are not supported".
I understand that the first option is probably not for 3.5 (it is beta already), but I will be happy if the second option will be implemented in 3.5 |
|
Date |
User |
Action |
Args |
2015-06-29 11:28:43 | levkivskyi | set | recipients:
+ levkivskyi, gvanrossum, vstinner, yselivanov |
2015-06-29 11:28:43 | levkivskyi | set | messageid: <1435577323.48.0.769775989737.issue24528@psf.upfronthosting.co.za> |
2015-06-29 11:28:43 | levkivskyi | link | issue24528 messages |
2015-06-29 11:28:42 | levkivskyi | create | |
|