On Fri, Feb 22, 2013 at 12:00 PM, Christian Heimes <christ...@python.org> wrote: > 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.
There is an (undocumented and CPython-specific) way: >>> range.__flags__ & (1 << 10) 0 >>> int.__flags__ & (1 << 10) 1024 Daniel -- http://mail.python.org/mailman/listinfo/python-list