[Python-ideas] Add an introspection API to Executor

Antoine Pitrou antoine at python.org
Tue Aug 26 06:13:53 CEST 2014


Le 25/08/2014 23:56, Andrew Barnert a écrit :
>>
>> What if an implementation wants to use something other than a queue?
>> It seems you're breaking the abstraction here.
>
> A collection of threads and a shared queue is almost the definition of a thread pool. What else would you use?

Definitions don't necessarily have any relationship with the way a 
feature is implemented. Perhaps some version of concurrent.futures would 
like to use some advanced dispatch mechanism provided by the OS (or 
shared memory, or whatever).

(I'll note that such "flexibility" has been chosen for the API of 
threading.Condition and it is making it difficult to write an optimized 
implementation that would you use OS-native facilities, such as pthread 
condition variables)

We have come from a simple proposal to introspect some runtime 
properties of an executor to the idea of swapping out a building block 
with another. That doesn't sound reasonable.

Regards

Antoine.




More information about the Python-ideas mailing list