[issue8486] [PATCH] threading.Event()
Benjamin VENELLE
report at bugs.python.org
Wed Apr 21 15:52:45 CEST 2010
Benjamin VENELLE <kain94 at gmail.com> added the comment:
> In this case, you don't have to use an Event. A boolean attribute on one
> of your objects is enough.
> (similarly, you would use a "volatile" variable in C)
This is already the case with Event. Look at threading.py @line ~355 Event class has a kinda private attribute _flags which is set/unset right before notifying. Using a boolean would look almostly the same so why to reinvent the wheel ? :)
If you look also at is_set(), it has the same meanings than __bool__() (ie returning True or False according to object's status). My suggest is only to had the following two lines:
def __bool__(self):
return self.is_set()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8486>
_______________________________________
More information about the Python-bugs-list
mailing list