How to structure packages

Steven D'Aprano steve+comp.lang.python at
Wed Sep 7 20:29:26 EDT 2011

Peter Otten wrote:

> Classes and functions are grouped into
> submodules by their functionality rather than employing Java's mechanical
> one-class-per-file pattern.

Surely it's an anti-pattern?

I suppose "one class per file" might be useful for those using an editor
with no search functionality. Other than that, is there any justification
for this rule? Any Java fans want to defend this?

If "one class per file", why not "one method per class" too? Why is the
second rule any more silly than the first?


More information about the Python-list mailing list