On Mon, 24 Apr 2017 10:10 pm, id23...@gmail.com wrote: > I do not quite understand how inheritance works in Python. [...]
> class mainCL(): > def __init__(self): > self.path1 = "/a" > self.path2 = "/b" > > class secondCL(mainCL): > def __init__(newID): > self.pathID = self.path2+"/id"+str(newID) secondCL over-rides the __init__ method of mainCL and prevents it from running. If you want to overload a method, you have to ensure that the superclass method is called. Do this instead: class secondCL(mainCL): def __init__(self, newID): super().__init__(newID) self.pathID = self.path2 + "/id" + str(newID) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list