Documentation for importing modules / pythonpath?

Johannes Eble skywalkerpackage at hotmail.com
Sat Feb 22 03:24:34 EST 2003


Hi Steven,

thanks very much for your answer.

On Fri, 21 Feb 2003 06:37:59 -0700, Steven Taschuk
<staschuk at telusplanet.net> wrote:

...

>Why do you prefer having one class in one file? 

I think it works the Python way if you only have few classes in a
package and you leave that package untouched. But if you have a lot of
classes in the package and you have to change just a couple of them
then you always have to hack around inside a very large file modifying
only a small piece of it. Then you might think of splitting the
package into several files. But then you have to remember which part
of the package belongs to which file.

As far as I remenber, it is not only the Java way, but also the Eiffel
way to have one file per class. I prefer it because the class
structure, not the file structure, should influence the logical
structure of the program. You get this effect if you say 'One file is
one class, end of the story' . (In Smalltalk you even do not have to
think about the file location of your classes, you just browse and use
them, but that is another story. ;)

> (That always annoyed me in Java.)

It is probably a question of usage. I am much more used to the Java
way at the moment. The more time I spend with Python the more I will
probably like the Python way. On the other hand, I plan to program
with Jython using lots of Java packages. Then the Python parts of my
project will be organized in the Python way and the Java parts in the
Java way, respectively.

Johannes





More information about the Python-list mailing list