Parent references: hot or not?
Kiril Karaatanasov
karaatanasov at hotmail.com
Sun Apr 20 09:39:57 EDT 2003
Hi this looks much as a case where aquisition is the answer to your questions.
See this example:
import ExtensionClass, Acquisition
class C(ExtensionClass.Base):
color='red'
class A(Acquisition.Implicit):
def report(self):
print self.color
a=A()
c=C()
c.a=A()
c.a.report() # prints 'red'
d=C()
d.color='green'
d.a=a
d.a.report() # prints 'green'
a.report() # raises an attribute error
Aquisition is widely used in Zope. Here is alink to the standart guide:
http://debian.acm.ndsu.nodak.edu/doc/python-extclass/Acquisition.html
Hope this helps :)
More information about the Python-list
mailing list