Copy constructors

Alex Martelli aleaxit at yahoo.com
Mon Aug 13 17:47:46 EDT 2001


"Michael Robin" <me at mikerobin.com> wrote in message
news:52e5ab5f.0108131257.75a0e036 at posting.google.com...
> "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...

Yes, I can use an 'indirector' (that's basically what letter/envelope
is: Coplien, "Advanced C++", an oldie but goldie).  I'd rather not
have to code it up -- a weak reference (an almost-transparent,
built-in indirector) would do, if it just wasn't _weak_:-).


Alex






More information about the Python-list mailing list