[CentralOH] Delegate Property
mark at microenh.com
Sat Oct 9 06:38:39 CEST 2010
Is there a way to delegate a read/write property in a class instance to a read/write property in a different class's instance that is a data member of the class? The only way I can think of is to assign the property getter and setter, but with some ways of creating properties, getters and setters aren't easily gotten.
def a(): #@NoSelf
doc = """Docstring""" #@UnusedVariable
def fset(self, value):
self._a = value
a = property(**a())
self._a = 10
self.w = W()
I would like to have an 'a' property on B such that when read they read the a from the contained self.w and when written they write that a. In this example, the property is just using a local variable, but in a real-world case, the property could be doing some computations.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the CentralOH