One module per class, bad idea?
Fredrik Lundh
fredrik at pythonware.com
Tue Dec 12 04:51:49 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. As I have understood it,
> it is more common practice to have many classes in a Python module/file.
even more important is that in Python, you don't use classes for every-
thing; if you need factories, singletons, multiple ways to create
objects, polymorphic helpers, etc, you use plain functions, not classes
or static methods.
once you've gotten over the "it's all classes", use modules to organize
things in a way that makes sense to the code that uses your components.
make the import statements look good.
</F>
More information about the Python-list
mailing list