Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017年11月22日 09:01:16 -0800

On Wed, Nov 22, 2017 at 11:11 AM, Paul Moore <[email protected]> wrote:
[..]
> But by the logic you just described, await isn't (or shouldn't be)
> allowed, surely?
No, that's a stretch. People can understand and actually use 'yield
(await foo())', but they usually can't figure what 'yield (yield
foo())' actually does:
 def foo():
 yield (yield 1)
Who on this mailing list can meaningfully use the 'foo()' generator?
 async def bar():
 yield (await foo())
'bar()' is perfectly usable in an 'async for' statement and it's easy
to understand what it does if you spend an hour writing async/await
code.
Yury
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to