Hello, I am writing a module that will have two classes ('runners') I am calling them, as they will ultimately use subprocess to run a command line program, so they are basically option parsers, etc...
As I wrote the second 'runner', I realized many of the methods are going to be the same as the first, so I would actually like to create a third class that has the methods which are mutual between the two. The problem are the 'self' calls.... I know a code example might help, so I try to show it here (my code I'm afraid is too complex and ugly at the moment). You can see the it fails because MyTools doesn't have 'this' attribute... class MyTools: def f(self, this): print(this) def foo(self): this = self.this print(this) class MyProcess: def __init__(self): self.tools = MyTools() self.this = 'My Process, this' self.tools.f(self.this) self.tools.foo() if __name__ == "__main__": mp = MyProcess() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor