what's the general way of separating classes?

Felipe Almeida Lessa felipe.lessa at gmail.com
Mon Mar 20 10:55:00 EST 2006


Em Seg, 2006-03-20 às 15:42 +0000, John Salerno escreveu:
> Are related classes put into a single module then? Or is there some 
> recommended method for how to handle this?

IMHO, if they can be put on the same file without creating a huge one
(3000+ lines), then do it. If you can't, then instead of creating a
huge:

program/module.py

You can do lots of

program/modules/*.py

And create an program/modules/__init__.py that have something like

from program.modules.class1 import class1
from program.modules.class2 import class2

And, in the rest of your program, you can import class1 and class2 by
just issuing

from program.modules import class1, class2

HTH,

-- 
Felipe.




More information about the Python-list mailing list