subclassable types

Christian Heimes christian at python.org
Fri Feb 22 06:00:35 EST 2013


Am 22.02.2013 10:35, schrieb Wolfgang Maier:
> Also: can you use introspection to find out whether a type is valid as a
> base type?

I don't think so. For CPython the information is stored in the type's
structure. When type->tp_flags & Py_TPFLAGS_BASETYPE is true then
subclassing is allowed. But I know of no way to retrieve that
information from Python code.




More information about the Python-list mailing list