On 7/8/10 9:37 PM, 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.
If that is really true, then it belongs as one module, regardless of size -- I don't believe there's any certain count where you should draw this line. Now, once you get up to say, 5-10 KLOC, I find it hard to believe that everything there really does belong together and there's not a substantial subset of code which really belongs "more" together then it does with the surrounding code. That would then lend itself to be a new file in a package. But that can happen at 1 KLOC too. But then it can still be 5-10 KLOC which, to me, fits perfectly together still. Its just more likely the higher the count that you have subsets that would benefit from logical separation. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list