Test None for an object that does not implement ==

Christian Heimes lists at cheimes.de
Sun Dec 25 19:37:03 EST 2011


Am 25.12.2011 15:04, schrieb Chris Angelico:
> I think there are certain types that are actually not implemented as
> classes, and hence cannot be subclassed. This is almost certainly an
> implementation detail though; my testing was done in Py3.2 (on Windows
> fwiw).

Some extension types are not subclass-able on purpose. The feature isn't
available to heap types.
http://docs.python.org/c-api/typeobj.html#Py_TPFLAGS_BASETYPE Most
people have never noticed the deliberate limitation because only a few
special types are sub-classable.

Christian




More information about the Python-list mailing list