[New-bugs-announce] [issue24523] coroutine asyncio.wait() does not preserve order of elements
report at bugs.python.org
Sun Jun 28 08:30:54 CEST 2015
New submission from Марк Коренберг:
If I pass an list of futures/coroutines as (done, _) = asyncio.wait([...]), order of elements in `done` does NOT match order of elements in `wait`'s argument. This is not documented, and I don't know if that is a bug or not.
Also, documentation say:
Wait for the Futures and coroutine objects given by the SEQUENCE futures to complete.
Really, this should be SET, since order is not preserved. Or, sources should be patched to preserve the order. I think, it is not hard to preserve order [in asyncio code].
For example, in Tornado, it is guaranteed (and documented) that order is preserved, so I can write
[res1, res2] = yield [fut1(), fut2()]
and it is guaranteed, that res1 - is a result of fut1()
nosy: gvanrossum, haypo, mmarkk, yselivanov
title: coroutine asyncio.wait() does not preserve order of elements
versions: Python 3.4
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce