On Wed, Oct 14, 2009 at 4:27 PM, Kris Schnee
<kschnee@xxxxxxxxxx> wrote:
This is more of a general Python question.
I've finished testing a class with some functions I like. I want to use those functions in a new class, but not to use the module I just built. (Because I might end up with several such classes.) So I'm thinking of doing this:
-Make a new module.
-Give it a class that starts with no functions defined.
-Write a module containing the tested functions without their being part of a class. Eg.
def DoSomething(self,**options):
pass
-Import the tested functions as a module called "spam"
-Have the new module's class manually say, "self.DoSomething = spam.DoSomething".
Seems cumbersome, doesn't it? I'm basically trying to give my new class access to the neat functions while putting them into a separate module, so that the main module isn't cluttered by them. Or should I rely on a linear chain of inheritance, so that FancyClass is a subclass of BasicClass from another module?