[Python-Dev] "not an acceptable base type"?

Guido van Rossum guido@python.org
Wed, 08 Aug 2001 19:40:03 -0400


> Is there something tricky about subclassing strings (and ints, floats,
> ...)?  I've considered spending some time trying to make other types
> subclassable.  If each python-dev'er takes one it shouldn't take too
> long. :-)

The tricky thing is that you have to do most of the initialization in
tp_new (not tp_init), and yet you must allow a subclass to override
tp_alloc and tp_free.  Immutable types and types with their own free
list or caching definitely are trickier than the ones I did so far...

--Guido van Rossum (home page: http://www.python.org/~guido/)