def __init__(self, initial_value, value_forwarder=None): """ Initialize the object. initial_value -- the initial value value_forwarder -- the method that updates the actual value on the thing """ EventEmitter.__init__(self) self.last_value = initial_value self.value_forwarder = value_forwarder
def __init__(self, initial_value, value_forwarder=None): """ Initialize the object. initial_value -- the initial value value_forwarder -- the method that updates the actual value on the thing """ EventEmitter.__init__(self) self.last_value = initial_value if value_forwarder is None: def fn(_): raise AttributeError('Read-only value') self.value_forwarder = fn else: self.value_forwarder = value_forwarder