[Python-Dev] String views (was: Re: Proof of the pudding: str.partition())

skip@pobox.com skip at pobox.com
Thu Sep 1 05:16:05 CEST 2005


    James> I suspect this would be a pessimization most of the time, as it
    James> would require keeping a list of pointers to all the views
    James> referencing the string object.

I'm skeptical about performance as well, but not for that reason.  A string
object can have a referent field.  If not NULL, it refers to another string
object which is INCREFed in the usual way.  At string deallocation, if the
referent is not NULL, the referent is DECREFed.  If the referent is NULL,
ob_sval is freed.

Skip


More information about the Python-Dev mailing list