Hi!
I basically just want to create an alias to an attribute on an item's
superclass. So that after I create the subclass object, I can access the alias
attribute to get the value back.
<pre>
class Superclass(object):
def __init__(self, value):
"""
I want to pass x by reference, so that any time
x on the subclass is updated, so is the alias here
"""
self.alias = value
class Subclass(Superclass):
def __init__(self, x):
self.x = x
Superclass.__init__(self, self.x)
def __repr__(self):
return "x: %s\nalias: %s" % (self.x, self.alias)
if __name__ == "__main__":
foo = Subclass(1)
print foo.alias
foo.x = 6
# Should return 6 !!!
print foo.alias
</pre>
--
https://mail.python.org/mailman/listinfo/python-list