Python Class inherit from all submodules

Posted by Dhruv Govil on Stack Overflow See other posts from Stack Overflow or by Dhruv Govil
Published on 2012-09-04T21:06:27Z Indexed on 2012/09/04 21:38 UTC
Read the original article Hit count: 182

Filed under:
|
|
|

I'm currently writing a wrapper in python for a lot of custom company tools.

I'm basically going to break each tool into its own py file with a class containing the call to the tool as a method. These will all be contained in a package.

Then there'll be a master class that will import all from the package, then inherit from each and every class, so as to appear as one cohesive class.

masterClass.py

pyPackage
- __ init__.py

- module1.py
--class Module1
---method tool1

- module2.py
--class Module2
---method tool2

etc

Right now, I'm autogenerating the master class file to inherit from the packages modules, but I was wondering if there was a more elegant way to do it?

ie

from package import *
class MasterClass(package.all):
    pass

© Stack Overflow or respective owner

Related posts about python

Related posts about class