Copy constructors

Alex Martelli aleaxit at yahoo.com
Tue Aug 14 16:14:26 EDT 2001


"Neil Schemenauer" <nas at python.ca> wrote in message
news:mailman.997806503.15832.python-list at python.org...
> Alex Martelli wrote:
> > > Zope's persistency support manages this without assignment to
> > > __class__.  A persistent object has three states: ghost, valid, and
> >
> > Yes, and AMK has, it seems to me, posted eloquently as to
> > how and why this is a kludge (or at least that's how I
> > read AMK's posts on this thread), made necessary by the
> > extension-class disabling (effectively) __class__ changes.
>
> You can have the ability to efficiently subclass builtin
> types or the ability to assign to __class__.  Pick one.  I would choose

Or pick (e.g.) Ruby and get both.  What makes you think it HAS
to be "pick one" when many languages have neither (C++, say)
and several have both (Ruby, Smalltalk [with 'becomes'], Dylan...)?

> the first any day.  The effect of second can usually be achieved in some
> other way.

So can "the effect of first", or, how have we ever been able to
live with Python for so long?  If I *had* to choose, because some
evil witch hexed me to, I guess I'd choose subclassing builtins,
too -- more frequent opportunities.  But surely *some* ability
to keep a subset of the existing class-changing possibilities is a
possibility -- Guido himself mentioned "a subclass that doesn't
add slots" as one which could be an easily-checked safe case to
assign in lieu of an existing instance's __class__, for example.


Alex






More information about the Python-list mailing list