class Path(list): """ A path from the voltage source to ground. The path will be the components involved, and not the connections. """ def append(self, value): if not isinstance(value, Component): raise RuntimeError("Only components can be added.") elif value in self.path: # <-- how to check if it's in the current list? pass else: super().__append__(value)
super().__append__(value) is not a valid method to call. What would be a proper way to overwrite the list's append method in this custom list?