Ian Bicking: the old part of his blog


There's somewhat of a style, or at least a style that's been growing in recent years. A lot of Python's standard library is old, and has been written by many individuals.

The style that I'm seeing, and is advocated in Guido's style guide, is to keep package and module names lower case, which I like. Zope 2 has the terrible example 'DateTime.DateTime.DateTime', and I think that in the __init__.py of the DateTime package, there is (or was) a 'from DateTime import DateTime'

Zope 3, Twisted, and Docutils all use the lowered path/module style, and I find that makes them a lot easier to navigate and to use as a developer, because it's much easier to follow an import statement to a source file.

As for underscored module names - I think it's better to structure packages and modules so that module names are short but still meaningful. 'zope.security' is better than 'zope_security'.

As for enforcing anything - I still like that Python doesn't enforce anything, or put any magic on inferring meaning from spelling/capitalization. Ruby, if I remember correctly, turns anything that's ALL_CAPS into a constant. I like to use that as a guide, but not a rule (some constants tent not to be so constant ;).

The guides used now for modules and packages to be accepted into Python are:

http://www.python.org/peps/pep-0007.html (C)
http://www.python.org/peps/pep-0008.html (Python)
Comment on Style-insensitive names
by Jeffrey Shell