Benjamin VENELLE 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 priva
Antoine Pitrou added the comment:
> Yes, I agree when Event objects are used to sync threads. But in my
> case, I'm using them like signals to terminate some server's thread
> through a proper way.
In this case, you don't have to use an Event. A boolean attribute on one
of your objects is enoug
Benjamin VENELLE added the comment:
Yes, I agree when Event objects are used to sync threads. But in my case, I'm
using them like signals to terminate some server's thread through a proper way.
This is a just a "cosmetic" stuff to enhance readability.
--
_
Antoine Pitrou added the comment:
Due to the nature of an Event, you should in most situations wait() on it,
rather than test its value. Also, changing the boolean value of an Event would
break existing code. I therefore think this should be rejected.
--
nosy: +pitrou
___
New submission from Benjamin VENELLE :
Hi,
I'm suggesting to declare a __bool__() function as an alias for is_set() in
Event class from threading package. So Event objects could be used like
booleans.
Ex:
I thought 'while(not event): do_something()' is much intuitive than 'while(not
event.i