[issue45791] __instancecheck__ being checked of type(cls) instead of cls

Guido van Rossum report at bugs.python.org
Fri Nov 12 10:47:41 EST 2021


Guido van Rossum <guido at python.org> added the comment:

I'm torn. It's been like this for a very long time and Serhiy's reasoning makes some sense.

OTOH it *does* make more sense as it's written in the PEP. The basic idea is "the class has control over what is considered an instance of it" and it would be nice if this didn't require writing a metaclass. (Metaclasses are often problematic.)

As an experiment, could you implement the proposed behavior and see what fails in e.g. the stdlib or the test suites of the 100 most popular packages?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45791>
_______________________________________


More information about the Python-bugs-list mailing list