Carl Banks:
I think booleans should be completely disjoint from all other types,
as they are in Java. "and", "or", and "not" should accept only boolean
operands and return only boolean results.
I'd like "or" and "and" (and "not") to return booleans only, to avoid
bugs and make their meaning more transparent, but I like the fact that
empty containers like "" [] (,) {} are seen as false:
x = []
if x:
...
else:
... // goes here
bool([]) ==> False
So I don't mind "and", "or" to take non-booleans too as input:
[] or "aa" ==> True
I think that's a good compromise between practicality, and avoiding
bugs.
"not" already works that way, it takes other objects too as input, but
its output is always a bool:
True
Bye,
bearophile