isinstance is broken
imbosol at vt.edu
Mon Jan 20 20:24:59 CET 2003
Michael Hudson wrote:
> Carl Banks <imbosol at vt.edu> writes:
>> I think a C extension could create an object that is not an instance
>> of object, in which case isinstance(something,object) would return
> I think not, because a type is always an object.
> isinstance(c, object) == issubclass(type(c), object) == True.
> except for old-style instances
> My reading of the source would seem to confirm this, but I could well
> have missed something...
Correct. If you leave tp_bases empty, Python happily sets it to a
tuple of PyBaseObject.
More information about the Python-list