if the else short form

Arnaud Delobelle arnodel at gmail.com
Sat Oct 2 02:50:31 EDT 2010


Paul Rubin <no.email at nospam.invalid> writes:

> 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

Of course, but it's the wrong thing to ask if you want know if bools are
ints.  To find out via their types, you should ask:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
>>> issubclass(type(True), type(3))
True

-- 
Arnaud



More information about the Python-list mailing list