glyph at twistedmatrix.com
Sat Aug 11 22:27:19 CEST 2001
On Sat, 11 Aug 2001, Guido van Rossum wrote:
> "Alex Martelli" <aleaxit at yahoo.com> writes:
> > I call the feature 'rarely used', but others may use it less
> > rarely.
For example, me.
Am I correct in understanding from this thread that there is an intent to
remove the ability to assign an instance's __class__ attribute?
> Let's just say that use of this feature is at your own risk. It was
> an experiment. I *could* restore it partially (see below) but I'd
> rather not, given that better alternatives are available.
Are there any features that we can use any longer that are not 'at our own
risk'? Division will be changed, __class__ assignment is going away,
type() means something different, even the rules of scope...
Also, as far as I know, better alternatives do not exist; for example,
"promise" objects from a database which are latently initialized when they
are accessed. One module that I use *all the time*;
twisted.python.rebuild.rebuild, is based entirely upon this "trick". One
of the eye-popping cool features of Python is the ability to change code
and have existing instances update to use the new methods automatically.
Smalltalk's Object>>become: is highly useful for similiar reasons; is
there a new way to emulate this without __class__ assignment?
> I'm sure I'd be able to come up with some kind of check that works. It
> would probably be very similar to the check I already use to determine
> whether two base classes are compatible -- the check that stops you
> from doing "class C(list, dictionary)". But I repeat: I'd rather not.
Is there a discussion somewhere of why you'd rather not? This is
*essential* functionality for me, especially since it sounds like it won't
be able to be completely replicated through some other mechanism. (If you
implement "reference.become(other)", for example, I won't mind nearly so
much <0.5 wink>)
> That depends on how much of a slowdown it is. :)
I don't know about others who use this feature, but the way I use it I
could afford to wait 0.5 seconds for each __class__ assignment and not be
too upset about it. Losing this ability entirely, however, would remove a
significant feature from Twisted when used with a later python version.
I implore you not to remove it.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
More information about the Python-list