3 ms·
True. If I'm expecting a bool and just writing is True to program defensively, what I should really be doing is assert(type(x) is bool) if I want to make sure I
by benatkin 15y ago
True. If I'm expecting a bool and just writing is True to program defensively, what I should really be doing is assert(type(x) is bool) if I want to make sure I was given a boolean value or x = bool(x) if I want to make sure I'm outputting bool.