[Python-ideas] Add __nonzero__ to threading.Event
Benjamin Peterson
benjamin at python.org
Mon May 11 23:51:15 CEST 2009
Floris Bruynooghe <floris.bruynooghe at ...> writes:
>
> Hi
>
> I was wondering why threading.Event hasn't got the __nonzero__ special
> attribute? I think it would allow for code to be more pythonic if you
> could just do "if e: ..." instead of "if e.isSet(): ..."
> (or "if e.is_set(): ..." in 2.6+).
-1 As with Antoine, I find conflating an Event's flag with its boolean value
confusing. I also don't see other precedent for this in the standard library.
(locks for example)
More information about the Python-ideas
mailing list