On Fri, 07 Sep 2007 12:26:46 -0700, Zentrader wrote:

> Looks like a "feature" of isinstance() is to consider both True and 1 as
> booleans, but type() distinguishes between the two.

That's not a "feature", it is just OOP.  `bool` is a subclass of `int`
therefore every `bool` instance is also an instance of `int`.  There's
nothing special about it.

In [57]: issubclass(bool, int)
Out[57]: True

In [58]: bool.__base__
Out[58]: <type 'int'>

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to