Give a reference to a python instance attribute at class definition
- by Guenther Jehle
I have a class with attributes which have a reference to another attribute of this class. See class Device, value1 and value2 holding a reference to interface:
class Interface(object):
def __init__(self):
self.port=None
class Value(object):
def __init__(self, interface, name):
self.interface=interface
…