[Zope3-dev] packaging conventions note

Guido van Rossum guido@python.org
Fri, 06 Dec 2002 11:05:14 -0500


> The downside is that then it's harder to find classes whose name you 
> know but not their module.  I don't like the idea of requiring module 
> names to be short and lowercase.  I do like the idea of package names 
> being short and lowercase, OTOH.

Too bad.  Martijn's proposal is getting cheers at the sprint, and it
includes short (Python stdlib style) module names.

Use a tags files to find a class (see myt diary) -- I've just started
using this and it's really handy.

> Java's convention of naming the module the same as the class is a big 
> advantage for navigating lots of code.  You rarely have to guess where a 
> class is located.  (Just look at Twisted.  If you want to find the 
> "TwistedSocketNotifier" class, would you know to look in "qternet.py" 
> without using grep?)  Unfortunately, as you know, that convention 
> clashes with Python's __init__.py, resulting in names being obscured.

You're looking it from the wrong p.o.v. :-)  With the multiple-
classes-per-module rule, you can think of these modules as equivalent
to Java packages.

> public.py / api.py provide a way to name the module and the class the 
> same without the problems associated with doing so.  But since it's 
> possible to drop a public.py into any package without disturbing it, the 
> real question is whether we *require* people to name their modules 
> differently from their classes.  You're suggesting that we make such a 
> requirement, but it seems harsh.  It's hard to guess at someone else's 
> abbreviations.

We alleviate this by putting many things in the same file.

(Last post for the day, we're closing the sprint space.)

--Guido van Rossum (home page: http://www.python.org/~guido/)