noob import question

Carl Banks invalidemail at aerojockey.com
Sat May 20 05:02:14 EDT 2006


PA wrote:
> On May 19, 2006, at 15:33, Diez B. Roggisch wrote:
>
> > And it seems as if you have some JAVA-background, putting one class in
> > one
> > file called the same as the class. Don't do that, it's a stupid
> > restriction
> > in JAVA and should be avoided in PYTHON.
>
> Restrictive or not, what's so fundamentally devious in putting a class
> declaration in a separate file whose name is that of the declared class
> (class Queue -> Queue.py)?
>
> Sounds like a handy way of organizing your code, no?

Handy for a lazy programmer, maybe.  Confusing for the reader, though
(do you mean Queue module, or Queue class? I must scroll up...).  And
highly tacky.  I recommend avoiding it.  For modules, I recommend "act
of" words (words ending in -ing and -ion) because such words aren't
common identitiers.  So queuing instead of Queue.

Unfortunately, the Python library isn't setting a good example here.
Too much glob.glob, time.time, socket.socket, and Queue.Queue.  I hope
all these go away in Python 3000.


Carl Banks




More information about the Python-list mailing list