News for hackers. Stuff that matters.
Re:Hidden features of Python by mccutchen on Tuesday July 13, 2010 @11:44PM (#1513531)
This is just a side-effect of bool being a subclass of int and True and False having the values 1 and 0, respectively. It might seem weird or surprising, but it's not a problem with Python's type system.

    >>> issubclass(bool, int)
    True
    >>> isinstance(True, int)
    True
    >>> int(True)
    1
    >>> int(False)
    0
    >>> True == 1
    True
    >>> False == 0
    True

There are no comments on this comment yet.