Why NOT only one class per file?
Fuzzyman
fuzzyman at gmail.com
Wed Apr 4 18:48:46 EDT 2007
On Apr 4, 10:23 pm, "Chris Lasher" <chris.las... at gmail.com> wrote:
> A friend of mine with a programming background in Java and Perl places
> each class in its own separate file in . I informed him that keeping
> all related classes together in a single file is more in the Python
> idiom than one file per class. He asked why, and frankly, his valid
> question has me flummoxed.
>
Only tightly coupled (and short) classes and functions.
It is better to keep modules as short as possible (and classes to),
without being ridiculous.
It is kind of obvious that keeping stub classes (exceptions for
example) in the same file is a good thing.
Diffing classes doesn't seem like a terribly good use-case: classes
that are *that* similar badly need refactoring into less classes...
Fuzzyman
http://www.voidspace.org.uk/python/articles.shtml
More information about the Python-list
mailing list