This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hynek
Recipients aronacher, docs@python, gvanrossum, hynek, vstinner, yselivanov
Date 2016-11-08.16:26:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478622378.55.0.352245281074.issue27589@psf.upfronthosting.co.za>
In-reply-to
Content
Such an idiom is IMHO not the main usefulness of this function tho.

As an (untested) example, something like

async def f(n):
   await asyncio.sleep(n)
   return n

for f in asyncio.as_completed([f(3), f(2), f(1)]):
    print(await f)


will print:

1
2
3

That’s *super* useful if you’re coordinating multiple independent external systems and need to process their results as soon as they arrive (and not once they’re *all* done).

Maybe it always worked by accident for me but it’s my understanding, that that is what this function is for (and I haven’t found another way to achieve it).

That’s why it would be nice if there’d be authoritative docs on what it’s supposed to do. :)
History
Date User Action Args
2016-11-08 16:26:18hyneksetrecipients: + hynek, gvanrossum, vstinner, aronacher, docs@python, yselivanov
2016-11-08 16:26:18hyneksetmessageid: <1478622378.55.0.352245281074.issue27589@psf.upfronthosting.co.za>
2016-11-08 16:26:18hyneklinkissue27589 messages
2016-11-08 16:26:18hynekcreate