isinstance is broken

Steve Holden sholden at holdenweb.com
Sun Jan 19 17:07:43 EST 2003


"Michele Simionato" <mis6 at pitt.edu> wrote in message
news:2259b0e2.0301181542.5264be68 at posting.google.com...
[ ... ]
> Here I don't feel stupid; I didn't know that. You are saying essentially
> that c *does* inherit __new__ from object, but it cannot be accessed with
> c.__new__ due to an implementation detail (i.e. getattr looks for
__class__
> which is not there); it can be accessed via type(c) anyway.
> This is an inconsistency of old style classes: they inherits from object
> but you cannot access object methods in the usual way.
>
Indeed, old-style classes were the *only* inheritacnce mechanism until
fairely recently. Python is in the middle of what's usually referred to as
"type/class unification": when that effort's completed, the inconsistency
will go away, as all user-defined classes will inherit directly or
indirectly from object.

> Thanks to everybody for the explanations,
>
One of the nice parts about hanging round c.l.py.

regards
--
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Bring your musical instrument to PyCon!    http://www.python.org/pycon/







More information about the Python-list mailing list