Message103844
> 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() |
|
Date |
User |
Action |
Args |
2010-04-21 13:52:45 | Kain94 | set | recipients:
+ Kain94, pitrou |
2010-04-21 13:52:45 | Kain94 | set | messageid: <1271857965.51.0.00702373681995.issue8486@psf.upfronthosting.co.za> |
2010-04-21 13:52:44 | Kain94 | link | issue8486 messages |
2010-04-21 13:52:44 | Kain94 | create | |
|