Stefan Hölzl <stefan...@posteo.de> added the comment:

It would allow to use Futures with a customized interface for a specific domain.
e.g. to not only save the result of a task but also some context informations
or provide properties/methods which are result specific.

But when subclassing Future the builtin Thread/ProcessExecutor cannot be reused 
anymore, because
the returned class on submit cannot be customized to be the subclassed Future.

With my change it would be possible to customize the Future object returned by 
the Executor.

As it is now the Future class has to be wrapped and the Executor subclassed
to return a wrapped Future object. 
The Future object cannot be extended without completely wrapping it.

This change would make the Executor class more versatile.

It would allow something like this:

class CustomExecutor:
        ...

custom_executor = CustomExecutor()
custom_future = custom_executor.submit(workload, context=context_information)
...
assert custom_future.context_has_some_property()
assert custom_future.result_has_some_property()


factories are also used in other places in standard library:
logging.setLogFactory
asyncio.loop.set_task_factory

----------

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

Reply via email to