One module per class, bad idea?

Andy Dingley dingbat at codesmiths.com
Tue Dec 12 06:06:45 EST 2006


Matias Jansson wrote:

> I come from a background of Java and C# where it is common practise to have
> one class per file in the file/project structure.

Don't confuse packages and files.  Java commonly splits a package
across many files, Python binds a module to a single file. If you see
"Java package" as more comparable to "Python module" then the
difference in how many classes are in a file becomes unimportant.

Java also puts many classes in the same source file, if they're tightly
coupled (e.g. Swing UI). It spits them out into separate .class files
though.




More information about the Python-list mailing list