Splitting a class definition into several files?
Diez B. Roggisch
deetsNOSPAM at web.de
Mon Nov 15 19:51:38 EST 2004
Jerry wrote:
> My "main" class is getting a bit long...Is it possble to split a class
> definition into several files and then import the pieces to get the whole
> definition?
I think there is some design issue if you really have a problem like this.
Apart from that, it should be possible to compose your main class by
inheriting from several subclasses that are in distinct files, like this:
---file A ---
class A:
def a(self):
pass
---file B ---
class B:
def b(self):
pass
---file main ---
class Main(A,B):
def __init__(self):
pass
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list