[Python-Dev] Subclassing varying length types (What's a PyStructSequence ?)

Tim Peters tim.one@home.com
Fri, 30 Nov 2001 18:35:23 -0500


[M.-A. Lemburg]
> ...
> Hmm, this makes me wonder: perhaps we should start thinking
> about phasing out varying length PyObjects in the interpreter...

No chance, IMO:  the memory savings is too great.

> esp. the inability to subclass strings looks like a bummer for
> future extensions of this particular type. Unicode doesn't have
> this problem, BTW.

OTOH, I know someone at Zope Corp who could testify with force about the
memory burden of switching to Unicode strings -- if you've got gobs of 'em,
it's much worse than a factor of 2 blowup.  Moving to obmalloc.c should help
that a lot (two malloc overheads per Unicode string, and obmalloc overheads
are much lower).

> Or we need to come up with a fairly nice way of making
> subclassing varying length types a lot easier, e.g. by
> adding a special pointer ob_ext to PyObject_VAR_HEAD
> which then allows declaring type extensions in an malloced
> buffer.
>
> Thoughts ?

Not a one <wink>.