[Tutor] help with 'organization'

John washakie at gmail.com
Thu Aug 25 19:51:15 CEST 2011

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):

    def foo(self):
        this = self.this

class MyProcess:
    def __init__(self):
        self.tools = MyTools()

        self.this = 'My Process, this'



if __name__ == "__main__":
    mp = MyProcess()

More information about the Tutor mailing list