-
-
Notifications
You must be signed in to change notification settings - Fork 377
Closed
Labels
Description
I've now hit enough bugs where someone wrote if event: rather than if event.is_set(): that I think Event.__bool__() should raise an error of some kind, likely NotImplementedError("Trio events cannot be treated as bools; consider using 'event.is_set()'").
I could be argued into def __bool__(self): return self.is_set() but disprefer this - "there should be one obvious way to do it". Thoughts?
I don't think there's as urgent a need on other classes, but we could consider e.g. Condition and Semaphore too...
CoolCat467, alexeyshockov and bergus