Author pablogsal
Recipients asvetlov, pablogsal, yselivanov
Date 2018-04-24.11:05:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Given this async function:

async def elements(n):
    yield n
    yield n*2
    yield n*3
    yield n*4

This definition is considered invalid:

async def test():
    return { n: [x async for x in elements(n)] for n in range(3)}

SyntaxError: asynchronous comprehension outside of an asynchronous function

The reason (I suspect) is because the dict comprehension is not an async context (it would be if range was an async iterable and we use `async for n in range(3)`). 

Is this expected behaviour or something it needs to change?
Date User Action Args
2018-04-24 11:05:41pablogsalsetrecipients: + pablogsal, asvetlov, yselivanov
2018-04-24 11:05:41pablogsalsetmessageid: <>
2018-04-24 11:05:41pablogsallinkissue33346 messages
2018-04-24 11:05:41pablogsalcreate