My stupidity / strange inconsistency overriding class methods

andrew cooke andrew at acooke.org
Wed Apr 20 08:11:42 EDT 2011


Thanks for finding that reference in the data model docs!  I was about to post a bug report because in PEP 3119 it says otherwise:

> The primary mechanism proposed here is to allow overloading the built-in 
> functions isinstance() and issubclass(). The overloading works as follows: 
> The call isinstance(x, C) first checks whether C.__instancecheck__ exists, 
> and if so, calls C.__instancecheck__(x) instead of its normal implementation. 

http://www.python.org/dev/peps/pep-3119/

But that's now what's implemented in Issue http://bugs.python.org/issue1708353 which behaves as you quoted (only on the metaclass).

Cheers,
Andrew



More information about the Python-list mailing list