One module per class, bad idea?

billie gnewsg at gmail.com
Wed Dec 13 04:04:40 EST 2006


Isaac Rodriguez wrote:

> > Yes, it would be a bad idea. =)
>
> Saying it is a bad idea and not explaining why will not help anyone. I
> would like you to elaborate on why it is a bad idea to have one file
> per class.
>
> Thanks,
>
> - Isaac.

Because it's just a useless limitation.
Python lets you the freedom to decide if using one class per file or a
lot of classes per file and this, imho, is a great advantage of Python
other Java.
Personally I like to have the possibility to include multiple classes
in one module if I need them. Obviously I'll hardly mix classes having
different tasks in the same .py file.
If you come from Java feel free to use the Java approach.




More information about the Python-list mailing list