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

Jeffrey Yasskin report at bugs.python.org
Mon Jun 30 06:10:29 CEST 2008


Jeffrey Yasskin <jyasskin at gmail.com> added the comment:

I don't think so. It wouldn't be a bug if I wrote:

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

but it is a bug that the isinstance call raises an exception. If recent
builds no longer raise an exception, then the bug should be closed.

You guys also seem to have missed that the examples in PEP 3119 in fact
define __instancecheck__ as a normal method on a metaclass (which makes
it a classmethod on classes derived from that metaclass) instead of as a
classmethod on a metaclass.

----------
resolution: invalid -> 
status: closed -> open

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


More information about the Python-bugs-list mailing list