something wrong with isinstance

Terry Reedy tjreedy at udel.edu
Fri Feb 13 13:05:10 EST 2009


Gabriel Genellina wrote:
> En Fri, 13 Feb 2009 08:43:03 -0200, Peter Otten <__peter__ at web.de> 
> escribió:

>>>>> class Type(type):
>> ...     def __instancecheck__(self, other): return True
>> ...
>>>>> class A(metaclass=Type): pass
>> ...
>>>>> class B: pass
>> ...
>>>>> isinstance(B(), A)
>> True
>>
>> See also
>>
>> http://www.python.org/dev/peps/pep-3119/#overloading-isinstance-and-issubclass 
>>
> 
> Ah, ok. Isn't menctioned in the main documentation though.

Lack reported in http://bugs.python.org/issue5250




More information about the Python-list mailing list