isinstance is broken

Jp Calderone exarkun at intarweb.us
Sat Jan 18 12:15:52 EST 2003


On Sat, Jan 18, 2003 at 08:50:25AM -0800, Michele Simionato wrote:
> There are inconsistencies in "isinstance".
> 
> Example 1:
> 
> >>> isinstance(int,object)
> 1
> 
> gives no error message. I don't like it, an error should be
> raised. There is issubclass for that job:
> 
> >>> issubclass(int,object)
> 1
> 

  This isn't an inconsistency.

>>> int.__class__.__bases__
(<type 'object'>,)

  If it returned 0, it would be inconsistent.

  For the rest of your examples, I'm not sure I like the behavior, but it
does seem intentional.  I'd be interested to here from a Python developer
just why this behavior was decided upon.

-- 
A sad spectacle.  If they be inhabited, what a scope for misery 
and folly.  If they be not inhabited, what a waste of space.
                -- Thomas Carlyle, looking at the stars
-- 
 12:00am up 33 days, 9:48, 4 users, load average: 0.08, 0.17, 0.17
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030118/267cde89/attachment.sig>


More information about the Python-list mailing list