Kyle Stanley <aeros...@gmail.com> added the comment:

> This leaves just future.state() and having the states as publicly accessible 
> module-level constants.

After reading over the python-ideas again and having some time to reflect, I 
think we can start with just adding future.state(), as that had the most value. 
Since future.state() is primarily intended for debugging/informational purposes 
as an approximation (similar to `queue.qsize()`) rather than something to be 
consistently relied upon, I don't see a strong practical use case for returning 
the states as enums (instead of a string).

If we consider adding a means to directly modify the state of the future in the 
future or providing an option to safely read the state of the future (through 
its RLock) later down the road, it may be worth considering. But not at the 
moment, IMO.

I'll update the name of the issue accordingly, and should have time to open a 
PR in the next few days. It should be rather straightforward, with the main 
emphasis being on the documentation to ensure that it clearly communicates the 
purpose of future.state(); so that users don't assume it's anything more than 
an approximation.

----------
title: Expand concurrent.futures.Future's public API -> Read approximate state 
of concurrent.futures.Future

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

Reply via email to