lego-mindstorms

Python Inheritance: Is it necessary to explicitly call the parents constructor and destructor?

Python Inheritance: Is it necessary to explicitly call the parents constructor and destructor? Question: I have some Code (for ev3dev): class Motor(object): def __init__(self, portName): self.base = "/sys/class/tacho-motor/motor" self.number = self.getMotorNumberWithSpecificPortName(portName) self.name = self.base + str(self.number) + "/" self.setDefaultValues() def __del__(self): self.callReset() (…) class TurnMotor(Motor): def __init__(self): super(TurnMotor, self).__init__("outA") def __del__(self): super(TurnMotor, self).__del__() The goal …

Total answers: 2