isinstance(False, int)

Steve Holden steve at holdenweb.com
Fri Mar 5 19:00:09 CET 2010


mk wrote:
>>>> isinstance(False, int)
> True
>>>>
>>>> isinstance(True, int)
> True
> 
> Huh?
> 
>>>>
>>>> issubclass(bool, int)
> True
> 
> Huh?!
> 
>>> 3+True
4
>>> 3+False
3
>>>

Just a brainfart from the BDFL - he decided (around 2.2.3, IIRC) that it
would be a good ideal for Booleans to be a subclass of integers.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list