Best practice in organize classes into modules

Chris Rebert clp2 at
Fri Jan 9 06:22:03 CET 2009

On Thu, Jan 8, 2009 at 9:09 PM, Steven Woody <narkewoody at> wrote:
> On Fri, Jan 9, 2009 at 1:02 PM, James Mills
> <prologic at> wrote:
>> On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody <narkewoody at> wrote:
>>> In C++/Java, people usually put one class into one file.  What's the
>>> suggestion on this topic in Python?  I so much interesting this
>>> especially when exception classes also involved.
>> Normally i group related functionality into the one module.
> Will that lead to too large source file size?  Is there a
> recommendation on max lines of a python source?  Thanks.

I don't think there's really a hard-and-fast rule (just like in Java &
C++!). When the program starts to feel unwieldly, then start splitting
it into multiple modules. Python files can generally contain several
classes and functions and still be quite manageable.


Follow the path of the Iguana...

More information about the Python-list mailing list