-
Notifications
You must be signed in to change notification settings - Fork 360
Description
While developing using 3.0dev, I misread the documentation and passed in prevent_dispatch=False to allow events to pass to multiple sections. Because of my mistake, I spent 30 minutes trying to figure out why I'm not seeing any events in my other section.
This init code:
Line 99 in 9aa8e1a
| self.prevent_dispatch: Iterable = prevent_dispatch or {True} |
Means that if the caller passes in False, it silently gets translates to {true}, which is not intuitive.
I realize this is documented and also that mypy would have caught it, but I fell for it so others probably would too. Since 3.0 is still in beta there's still the possibility of changing the API so I thought I might as well raise this point.
To me, It also seems natural for ''True|False" values to do what you'd expect, but I understand typing simplicity makes this less attractive.
Possible solutions:
- Use
{True} if prevent_dispatch is None else prevent_dispatchinstead - Add asserts on input types.