Yuval Greenfield writes:
In python 3.2.3:
>>> 1 == True True
- 13 == True*
- False*Truebool(1)Truebool(13)False1 is TrueFalse13 is True
To my surprise identity is actually less confusing than equality. So I agree with Antoine and Michael on that point.
FWIW, I don't find any of the above confusing. "1 == True" => True is unexpected in some sense, but I don't find it counter-intuitive, and I find the "don't break old code" rationale satisfactory.
Inada-san's example of addition is a little disconcerting in that particular spelling. But
sum(predicate(x) for x in seq)
seems preferable to a boolean-specific count function, and it generalizes nicely to the creation of dummy variables in statistical applications.