Best practice in organize classes into modules

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri Jan 9 09:54:44 CET 2009

Steven Woody a écrit :
> 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? 

When the case happens, then you can safely refactor the module into a 
package with submodules, and use the package's to make it a 
facade for the submodules so the refactoring is transparent for client code.

But given Python's expressivity and metaprogramming features, it's 
usually easy to avoid cruft and boilerplate and keep the code short.

> Is there a
> recommendation on max lines of a python source?

Not really - use your own judgement, mostly. As far as I'm concerned, I 
start worrying about this when a module grows bigger than 1Kloc, but I 
seldom have this problem.

More information about the Python-list mailing list