[Python-Dev] [PEP 3148] futures - execute computations asynchronously

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 8 23:03:47 CET 2010


Dj Gilcrease wrote:

> executor = executors.create(NAME, *args, **kwargs) # NAME is 'process'
> or 'thread' by default
> 
> from concurrent.futures import executors, ExecutorBase
> class MyExecutor(ExecutorBase): ...
> executors.register(NAME, MyExecutor)

I don't understand the reason for using a registration system
rather than just importing names from a module.

You mentioned wanting to globally change the executor class
being used by a program without having to make changes throughout.
Registering a different class under the same name would be one
way to do that, but you could achieve the same thing just by
assigning to a name in a module.

In other words, instead of inventing your own mechanism for
managing a namespace, just use a module as your namespace.

-- 
Greg


More information about the Python-Dev mailing list