New submission from Claudiu.Popa: 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. For instance, multiprocessing.pool.ThreadPool uses the same value. ---------- components: Library (Lib) files: concurrent_futures_workers.patch keywords: patch messages: 218763 nosy: Claudiu.Popa, bquinlan priority: normal severity: normal status: open title: concurrent.futures.ThreadPoolExecutor does not use a default value type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file35287/concurrent_futures_workers.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21527> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com