[Python-Dev] PEP 253: Subtyping Built-in Types

M.-A. Lemburg mal@lemburg.com
Sat, 21 Jul 2001 23:17:13 +0200

I've started playing with making mxDateTime types subclassable
and have run into a few problems which the PEP does not seem
to have answers to:

1. Are tp_new et al. inherited by subclassed types ?

This is important when implementing the slot methods, since
they may then see types other than the one for which they
are defined (e.g. keeping a free list around will only
work for the original types, not subclassed ones).

2. In which order are the allocation/deallocation methods
of subclass and base class called (if at all) and how
does this depend on whether they are implemented or inherited ?

3. How can I make attributes visible in subclassed types ?

Even though I found out that I need to use the generic APIs
PyObject_GenericGet|SetAttr() for the tp_get|setattro to
make methods visible, attributes cannot be accessed (and this
even though dir(instance) displays them).

In any case, the new feature looks very promising !

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/