New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executor.map does not submit futures until iter.next() is called #55986
Comments
from concurrent import futures
with futures.ThreadPoolExecutor(max_workers=5) as e:
e.map(print, range(10)) # No output |
Isn't this the supposed behavior? |
I think that it surprising behavior, especially considering that asking for the *first* element in the iterator causes *all* of the futures to be created. |
Got it. Seems the behavior is not consist with the Executor.map() function: "The returned iterator raises a TimeoutError if __next__() is called and the result isn't available after timeout seconds from ***the original call to map()***" |
Nice catch. I hadn't noticed that the docs are lying :-) |
New changeset 126353bc7e94 by Brian Quinlan in branch 'default': |
Just a bystander remark: when you use present in the commit message and Misc/NEWS entry (like in “Executor.map does not submit futures until iter.next() is called”), I don’t know whether it is the behavior being fixed (“X used to do Y”) or the new, correct behavior (“X now does Z”). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: