if the else short form

John Nagle nagle at animats.com
Mon Oct 4 01:21:05 EDT 2010


On 10/1/2010 10:19 PM, Paul Rubin wrote:
> Steven D'Aprano<steve at REMOVE-THIS-cybersource.com.au>  writes:
>> Incorrect. bools *are* ints in Python, beyond any doubt.
>
>      Python 2.6.2 (r262:71600, Jun  4 2010, 18:28:58)
>      >>>  type(3)==type(True)
>      False

     Yes, "bool" is a subtype of "int" in Python.  This was
because the original design of Python didn't have "bool"
(a rather strange mistake for a language designed this late)
and the retrofit had to have some backwards compatibility.

     That's why lame results such as "True + True" being 2.

				John Nagle




More information about the Python-list mailing list