[docs] [issue32306] Clarify map API in concurrent.futures
Antoine Pitrou
report at bugs.python.org
Tue Dec 19 09:37:22 EST 2017
Antoine Pitrou <pitrou at free.fr> added the comment:
Hi David,
> what happens behind the scenes is that the call blocks until all results are computed and only then starts yielding them.
The current implementation of the Executor.map() generator is:
def result_iterator():
try:
# reverse to keep finishing order
fs.reverse()
while fs:
# Careful not to keep a reference to the popped future
if timeout is None:
yield fs.pop().result()
else:
yield fs.pop().result(end_time - time.time())
finally:
for future in fs:
future.cancel()
So it seems to me that results are yielded as soon as they arrive (provided they arrive in the right order).
----------
assignee: -> docs at python
components: +Documentation
nosy: +docs at python, pitrou
type: enhancement -> behavior
versions: +Python 3.6, Python 3.7 -Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32306>
_______________________________________
More information about the docs
mailing list