[issue5998] Add __bool__ to threading.Event and multiprocessing.Event
Florian Berger
report at bugs.python.org
Tue Jan 10 14:49:56 CET 2012
Florian Berger <fberger at florian-berger.de> added the comment:
Voting for re-opening.
I am currently porting a non-threaded function for use within a threaded application. If threading.Event had __bool__, it would be a drop-in replacement for simple True/False flags that can not be used in multithreaded code.
To me, it is actually surprising that I can not do tests like "if event: ...". IMHO, "if event.is_set(): ..." is unnecessarily complicated, especially with the documentation speaking of a true/false flag all the time.
I will subclass threading.Event now and add __bool__, but I don't feel this is a nice solution.
----------
nosy: +fberger
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5998>
_______________________________________
More information about the Python-bugs-list
mailing list