[Zope-dev] Re: Replaceable Property question

Shane Hathaway shane@digicool.com
Mon, 07 Aug 2000 13:39:29 -0400


Chris Withers wrote:
> 
> Shane Hathaway wrote:
> > > Will there be any access to the method/object that is being overridden
> > > from inside the one overriding it? Something like:
> > >
> > >   'self.__class__.my_method("blah")'
> >
> > Depends on whether the original method comes from a ZClass or product.
> > If so, yes.  But if it's a regular object that's marked as replaceable
> > and it's replaced, the original will vanish.
> 
> Will it re-appear when the replacement is deleted?
> 
> That could be confusing...

No, and I think it's really not confusing, since it's quite a strange
and rare thing to set __replaceable__=ObjectManager.REPLACEABLE on a
normal instance.  :-/

Think of it more like Python instances vs. classes.  Setting
__replaceable__=REPLACEABLE on a ZClass method is like setting a class
attribute in Python, then overriding it in an instance is like setting
an instance attribute.  If you set __replaceable__=REPLACEABLE on an
instance attribute, then replace it, it's like setting "foo.a = bar"
then "foo.a = boo".  The reference to "bar" disappears without any
implicit recovery.

Shane