A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150704.html below:

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

[Python-Dev] Tricky way of of creating a generator via a comprehension expression [Python-Dev] Tricky way of of creating a generator via a comprehension expressionYury Selivanov yselivanov.ml at gmail.com
Wed Nov 22 11:58:08 EST 2017
On Wed, Nov 22, 2017 at 11:11 AM, Paul Moore <p.f.moore at gmail.com> 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4