define class over 2 files

greg greg at cosc.canterbury.ac.nz
Wed Aug 19 02:11:43 EDT 2009


naveen wrote:
>>>Is it possible to split up a class definition over multiple files?
>>
>>Not exactly, but you can do variations of this:
> 
> ... [subclass a class]

Multiple inheritance can also be useful:

# A_Part1.py

class A_Part1:
   ...

# A_Part2.py

class A_Part2:
   ...

# A.py

from A_Part1 import A_Part1
from A_Part2 import A_Part2

class A(A_Part1, A_Part2):
   ...

-- 
Greg



More information about the Python-list mailing list