3 ms·
It's bad because it beckons bad behavior. Instead of doing the simple thing and changing your if-statement which puts the idiosyncrasy in the relevant piece of
by gleenn 13y ago
It's bad because it beckons bad behavior. Instead of doing the simple thing and changing your if-statement which puts the idiosyncrasy in the relevant piece of code, you are tucking away the behavior out of sight when something like this almost definitely belongs directly in front of your eye-balls.
This is a bit of a strawman, but being able to do
class Foo(object):
def __bool__(self):
return random.random() > 0.5
shows how crazy you could be. If you really want something weird, put it in the if-statement
- eru 13y agoI do agree with you. That particular bit of craziness wouldn't be possible in Haskell. (Since that would require declared side-effects, and my interface above didn't have any declared.)