Ian Bicking: the old part of his blog

Naming Conventions

One thing that's nice about Zope 3 is that they've been fairly conscious about their coding standards. Being PEP 8 there's not a lot of guidance for coding standards, and PEP 8 is vague on a number of things.

For instance, they have some naming conventions, with a combination I've never really seen before. All public methods are named with mixed case, but local variables use underscores.

However, they don't address how some other objects should be named, for instance public objects. A common case would be a registry object; the class that implements the registry is never exposed publically, and there's always just one instance of that class. I often name the class something like _Registry and the instance Registry, but I think that may be confusing. In Smalltalk the convention is to use TheRegistry. But the class really is private, so a leading underscore is appropriate; however, maybe The is good, because it makes it clear you are dealing with an instance. I don't know.

Anyway, the lack of consistency, or even a strong convention in Python for these things is a bit annoying. Or maybe it would be nice if Python was like XL and was neutral on the whole matter.

Created 23 Jul '04
Modified 14 Dec '04


I like your idea of naming the class _Registry and the instance Registry. I don't think it's confusing at all, and the underscore signals your intent nicely.
# Dave Benjamin