A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2010-March/720882.html below:

isinstance(False, int)

isinstance(False, int) isinstance(False, int)Terry Reedy tjreedy at udel.edu
Fri Mar 5 16:27:56 EST 2010
On 3/5/2010 1:30 PM, MRAB wrote:
> mk wrote:
>> >>> isinstance(False, int)
>> True
>> >>>
>> >>> isinstance(True, int)
>> True
>>
>> Huh?
>>
>> >>>
>> >>> issubclass(bool, int)
>> True
>>
>> Huh?!
>>
> Python didn't have Booleans originally, 0 and 1 were used instead. When
> bool was introduced it was made a subclass of int so that existing code
> wouldn't break.

And because it is useful to make it so.

Terry Jan Reedy



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4