Opinions please -- how big should a single module grow?

Martin P. Hellwig martin.hellwig at dcuktec.org
Fri Jul 9 12:03:21 EDT 2010


On 07/09/10 05:37, Steven D'Aprano wrote:
> This is a style question rather than a programming question.
>
> How large (how many KB, lines, classes, whatever unit of code you like to
> measure in) should a module grow before I should break it up into a
> package? I see that, for example, decimal.py is>  3000 lines of code, so
> I can assume that 3 KLOC is acceptable. Presumably 3000 KLOC is not.
> Where do you draw the line?
>
> For the purposes of the discussion, you should consider that the code in
> the module really does belong together, and that splitting it into sub-
> modules would mean arbitrarily separating code into separate files.
>

Personally I like to split up my module quite early and the main 
criteria is whether this improves (IMO) maintainability.
So if I can refactor stuff that with some adaption can be used multiple 
times I put it in its own module. I rarely exceed 1KLOC per module and 
on average are on half of that.

-- 
mph




More information about the Python-list mailing list