Copy constructors

Michael Robin me at mikerobin.com
Mon Aug 13 16:57:15 EDT 2001


"Alex Martelli" <aleaxit at yahoo.com> wrote in message news:<9l4a9c023nn at enews4.newsguy.com>...
> "Glyph Lefkowitz" <glyph at twistedmatrix.com> wrote in message
> news:mailman.997561650.27157.python-list at python.org...
>     ...
> > 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*;
> 
> I don't know of any better way to handle the Promise design pattern,
> either.  In C++, I'm having to kludge around it all the time via
> letter/envelope idioms -- the possibility of changing classes on
> the fly makes it much simpler and more direct.  Hadn't thought
> of that earlier...

Can't you use a proxy object and override __call__ and friends?
(In a sense, that's what Smalltalk does with the Object Table,
vs. Python which uses a non-changing address for the object.)
Or am I missing something...

thanks,
mike



> 
> > 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.
> 
> That one seems to be related to _another_ capability (of which I've
> seen no indication that it's also going away) -- keeping the same
> class object. but changing that object (rebinding method attributes
> thereof).  Or maybe I don't understand exactly what you mean?
> 
> 
> > Smalltalk's Object>>become: is highly useful for similiar reasons; is
> > there a new way to emulate this without __class__ assignment?
> 
> It seems to me the functionality of become is homomorphic to that
> of class-assignment, unless I'm truly missing something major.
> 
> 
> Alex



More information about the Python-list mailing list