2 ms·
I agree that maybe you should write in a different, more strongly typed, language but saying that people encountering this bug are not writing code in a Pythoni
by ufo 13y ago
I agree that maybe you should write in a different, more strongly typed, language but saying that people encountering this bug are not writing code in a Pythonic style is too much like victim blaming, IMO. Its a bit like those times when people say that if only you were a good programmer following "proper" C++ idioms you will never ever encounter memory leaks or segmentation faults.
The default behaviour for objects in Python is being truthy and testing their existence with `if x` instead of `if x is not None` is definitely encouraged by the language (otherwise, why would it even let you use objects in a boolean context?). Having something that behaves like the default except once in a blue moon is just a trap and its unfair to blame it on the programmer.