One module per class, bad idea?

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Dec 12 15:49:20 EST 2006


On 12 dic, 16:17, "Isaac Rodriguez" <isaac.rodrig... at comcast.net>
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.

The HyperText package (http://dustman.net/andy/python/HyperText) has a
lot of classes (about 90 in HTML40.py); one class per HTML tag. Most of
them are oneliners with "pass" alone. All are public. It would be
nonsense to split them on one file per class just because you have a
rule that says so.
On the other hand, it would be nonsense too to mix a bunch of unrelated
classes all inside a single module, just because you can do that.
Common sense is hard to measure, but required as any other programming
skills. (Anyone knows the story of Epaminondas and his auntie?)

-- 
Gabriel Genellina




More information about the Python-list mailing list