[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

Matias Gonzalez report at bugs.python.org
Sat Jun 21 20:34:14 CEST 2008


Matias Gonzalez <gonzalezmatias at gmail.com> added the comment:

This is not a bug. Function __instancecheck__ should be a classmethod.

>>> class Meta(type):
...     @classmethod
...     def __instancecheck__(self, other):
...             return False
... 
>>> isinstance(3, Meta)
False

----------
nosy: +mato2000

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2325>
_______________________________________


More information about the Python-bugs-list mailing list