Benjamin VENELLE <kai...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue8486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to