New submission from Nick Coghlan:

The multiprocessing module currently provides the 
"multiprocessing.dummy.ThreadPool" API that exposes the same API as the public 
multiprocessing.Pool, but is implemented with threads rather than processes. 
(This is sort of documented - it's existence is implied by the documentation of 
multiprocessing.dummy, but it doesn't spell out "hey, stdlib ThreadPool 
implementation!".

Given that this feature is likely useful to many people for parallelising IO 
bound tasks without migrating to the concurrent.futures API (or where that API 
doesn't quite fit the use case), it makes sense to make it a more clearly 
documented feature under a less surprising name.

I haven't looked at the implementation, so I'm not sure how easy it will be to 
migrate it to a different module, but threading seems like a logical choice 
given the multiprocessing.ThreadPool vs threading.ThreadPool parallel.

(Honestly, I'd be happier if we moved queue.Queue to threading as well. Having 
a threading specific data type as a top level module in its own right just 
makes it harder for people to find for no real reason other than a historical 
accident)

Alternatively, we could add a "concurrent.pool" module which was little more 
than:

from multiprocessing import Pool as ProcessPool
from multiprocessing.dummy import ThreadPool

----------
components: Library (Lib)
messages: 181495
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Provide a more obvious public ThreadPool API
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17140>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to