Closed arnobaer closed 4 years ago
It turned out to be quite tedious/impractical to forward attributes using property classes, implementing Driver sub modules. Possible solution: stick back to classic attribute instances, prevent attribute assignments for Driver instances.
Driver
class Axis(Driver): def __init__(self, resource, index): super().__init__(resource) self._index = index class Venus1(Driver): def __init__(self, resource): super().__init__(resource) self.x = Axis(resource, 1) self.y = Axis(resource, 2) self.z = Axis(resource, 3) # Prevent accidental assignments >>> device = Venus1(...) >>> device.x = 4 ... AttributeError: can't set attribute
It turned out to be quite tedious/impractical to forward attributes using property classes, implementing
Driver
sub modules. Possible solution: stick back to classic attribute instances, prevent attribute assignments forDriver
instances.