Copy constructors

Guido van Rossum guido at python.org
Tue Aug 14 18:48:40 EDT 2001


Fortunately, Alex's message scrolled off my screen before I could
capture it, so I don't have to reply point-by-point. :-)

After talking to some more people and running an experiment
(converting Jeremy's compiler package to use the new class system), I
am convinced that both dynamic class features under attack recently
are important.  Making __dynamic__ the default slows things down by
about 25% for one particular benchmark (compiling the compiler with
itself), so I'll have to work on that.

I've also figured out the correct rule for allowing safe assignment to
__class__.  The underlying rule is that instances of the old and new
class have the same memory lay-out.  A necessary and sufficient
condition for this is (in our case) that the two classes have
instances of the same size, and that there is a common base class that
also has that same size.  In addition, the GC flag bits must be the
same.

Now I'm going to withdraw from Usenet again.  I prefer python-dev as a
platform for discussing language changes -- I get the same results
without being flamed, and I waste much less time.

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



More information about the Python-list mailing list