-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
concurrent.futures.ThreadPoolExecutor does not use a default value #65726
Comments
As the title says, ThreadPoolExecutor does not use a default value for max_workers parameter, as ProcessPoolExecutor does. When the user does not care about the number of workers and wants only for something to run in background, he has to write code like this: if processes:
executor = ProcessPoolExecutor()
elif threads:
executor = ThreadPoolExecutor(1) # or any other value This situation can also occur when the class is passed as a factory function: def create_pool(executor_factory):
if executor_factory is process pool:
executor = executor_factory()
else:
executor = executor_factory(1) This patch proposes using the number of cores as the default value for max_workers. |
+1. Makes it easier to swap Executors (which is a big selling point for the Executor framework), and number of cores is a reasonable default value. |
Looks good. |
Thank you, Guido. |
New changeset 2805b0dca798 by Guido van Rossum in branch 'default': |
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: