pep492_badsyntax_async10.pyx 521 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# mode: error
# tag: pep492, async

async def genexpr(it):
    return (await x for x in it)


async def listcomp(it):
    return [await x for x in it]


async def setcomp(it):
    return {await x for x in it}


async def dictcomp(it):
    return {await x:x+1 for x in it}


# NOTE: CPython doesn't allow comprehensions either


_ERRORS = """
5:12: 'await' not allowed in generators (use 'yield')
5:12: 'await' not supported here
26 27
# FIXME: remove when implementing async comprehensions
5:12: 'yield' not supported here
28
"""