Christophe wrote: > Chris Lasher a écrit : >> 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. > > In Java, you HAVE to place a class in it's own file. That's how the > language works. But in Java, you do not have to place each class in it's > own module/package, in fact, it would be bad. > > It's the same in Python: you do not want to have one class per > module/package. > > Unfortunately, in Python, a module/package is a file, and in Java, it's > a directory. Also, Python doesn't really have the notion of a "root > package/module". > > Translation: "import foo; foo.foo()" sucks so avoid having only one > class per module :)
One further thought: http://www.artima.com/weblogs/viewpost.jsp?thread=42242 regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list