Best practice in organize classes into modules

Steve Holden steve at holdenweb.com
Fri Jan 9 01:52:44 EST 2009


Chris Rebert wrote:
> On Thu, Jan 8, 2009 at 9:09 PM, Steven Woody <narkewoody at gmail.com> wrote:
>> On Fri, Jan 9, 2009 at 1:02 PM, James Mills
>> <prologic at shortcircuit.net.au> wrote:
>>> On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody <narkewoody at gmail.com> 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.
> 
The OP can take a look at the standard library to get some impression of
what's been considered acceptable over the years. Just remember that
some of the code is a little antiquated, as working code is not
rewritten just for the fun of fixing the bugs this would inject.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list