[New-bugs-announce] [issue23697] Module level map & submit for concurrent.futures

Nick Coghlan report at bugs.python.org
Wed Mar 18 04:20:20 CET 2015

New submission from Nick Coghlan:

Currently, concurrent.futures requires you to explicitly create and manage the lifecycle of a dedicated executor to handle multithreaded and multiprocess dispatch of concurrent activities.

It may be beneficial to provide module level tmap(), pmap(), tsubmit() and psubmit() APIs that use a default ThreadExecutor and/or ProcessExecutor instance to provide concurrent execution, with reasonable default settings for the underlying thread & process pools.

(Longer names like map_thread, and map_process would also be possible, but tmap & pmap are much easier to type and seem sufficient for mnemonic purposes)

This would allow usage like:

  done, not_done = wait(tmap(func, data))


  for f in as_completed(tmap(func, data)):
    result = f.result()

Ways to explicitly set and get the default thread and process pools would also need to be provided, perhaps based on the design of the event loop management interface in the asyncio module.

messages: 238373
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Module level map & submit for concurrent.futures

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list