Why NOT only one class per file?

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Fri Apr 6 16:15:42 CEST 2007


On Wed, 04 Apr 2007 14:23:19 -0700, Chris Lasher 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.


Hah! Writing one class per file is for wimps! When I program, I write one
*method* per file, then import them and build the class at runtime.

I have a friend who writes one *line* per file, then pulls them all
together with exec(), but that's just being stupid.



-- 
Steven.




More information about the Python-list mailing list