Copy constructors

gzeljko gzeljko at sezampro.yu
Mon Aug 13 05:39:44 EDT 2001


From: Guido van Rossum <guido at python.org>
> I don't know how familiar you are with Python's C-level internals. If
> you are, you'll appreciate the problem if I took a list object and
> changed its type pointer to the dictionary type -- the instance
> lay-out of a dictionary is different, and all the methods would be
> using the list data as if it were dictionary data.  Recipe for
> disaster.  Likewise, changing a featureless object into a list or dict
> would at the very least require growing the size of the instance; this
> would require a realloc(), which may move the object in memory.  But
> if there are other references to the object, these would all have to
> be updated.  Python's run-time architecture just doesn't support that.
> 

Is pointer indirection here to expensive ?

exuse-me-for-this-kind-of-post-ly-y'rs,
gzeljko










More information about the Python-list mailing list