[issue27589] asyncio doc: issue in as_completed() doc

2019-09-12 Thread Andrew Svetlov
Change by Andrew Svetlov : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue27589] asyncio doc: issue in as_completed() doc

2019-09-12 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Current docs read as below with an example to show that earliest future is returned. I guess this can be closed. https://docs.python.org/dev/library/asyncio-task.html#asyncio.as_completed Run awaitable objects in the aws set concurrently. Return

[issue27589] asyncio doc: issue in as_completed() doc

2016-11-08 Thread Guido van Rossum
Guido van Rossum added the comment: Well, in that case the idiom will be even simpler: wrap each one in a coroutine that awaits it and prints the result and then gather() all the coroutine wrappers. -- ___ Python tracker

[issue27589] asyncio doc: issue in as_completed() doc

2016-11-08 Thread Hynek Schlawack
Hynek Schlawack added the comment: 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

[issue27589] asyncio doc: issue in as_completed() doc

2016-11-08 Thread Guido van Rossum
Guido van Rossum added the comment: However, in general you should use a different pattern. Wrap each future in a coroutine that does whatever you want to do to the first one ready and maybe cancel the others. Then gather() all coroutines with the flag that keeps errors. --Guido (mobile)

[issue27589] asyncio doc: issue in as_completed() doc

2016-11-08 Thread Armin Ronacher
Armin Ronacher added the comment: I am not even sure what the function is supposed to tell me. The documentation is very unclear and the example code does not help. What is "fs" for instance? And why would it return things that are not from fs? -- nosy: +aronacher

[issue27589] asyncio doc: issue in as_completed() doc

2016-08-01 Thread Hynek Schlawack
Hynek Schlawack added the comment: More explicitly: The doc sells the function short. If you have a bunch of futures and want to know as soon as one of them is ready: this is the function for you. The only hint that this is the actual behavior comes from the *name* of the function; not the

[issue27589] asyncio doc: issue in as_completed() doc

2016-07-22 Thread STINNER Victor
New submission from STINNER Victor: Remark on as_completed() doc by Hynek. https://docs.python.org/dev/library/asyncio-task.html#asyncio.as_completed Futures are yielded in an unexpected order: as soon as a future completes. -- assignee: docs@python components: Documentation, asyncio