This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stefanhoelzl
Recipients asvetlov, bquinlan, pitrou, stefanhoelzl, tomMoral
Date 2019-05-10.17:57:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557511051.66.0.867571853968.issue36512@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-05-10 17:57:31stefanhoelzlsetrecipients: + stefanhoelzl, bquinlan, pitrou, asvetlov, tomMoral
2019-05-10 17:57:31stefanhoelzlsetmessageid: <1557511051.66.0.867571853968.issue36512@roundup.psfhosted.org>
2019-05-10 17:57:31stefanhoelzllinkissue36512 messages
2019-05-10 17:57:30stefanhoelzlcreate