integer >= 1 == True and integer.0 == False is bad, bad, bad!!!
Ian Kelly
ian.g.kelly at gmail.com
Sun Jul 11 03:11:31 EDT 2010
On Sun, Jul 11, 2010 at 12:57 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> And I think that partly this is simply historical. Before a proper
> boolean type was added to Python, 1 and 0 were the norm for storing
> truth values. Changing the truth value of 0 when bools were
> introduced would have broken tons of existing code. This is also the
> reason why bool is a subclass of int.
Another thought related to that list bit: if bool(0) were True, then
bool(int(False)) would also be True. That seems messed up. Then
again, bool(str(False)) is already True. Does that bother anybody
other than me?
More information about the Python-list
mailing list