Good programming style

Almar Klein almar.klein at gmail.com
Mon Sep 15 09:36:02 CEST 2008


>
> > Because the code we write rarely stays isolated from other
> > code. There is an existing convention,
>
> There are many existing conventions.
>

Even though there is a convention (PEP 8), there are standard
modules that do not follow it, like the subprocess module, which
uses CamelCase.

When packages as significant as wxPython use naming conventions
> other than PEP 8, I find it hard to make a case that the PEP 8
> naming convention is any better than any other.
>

A lot of C/C++ projects are wrapped in python, and with that, their naming
styles. As said above, it's often better to use the projects native naming
styles than to change it to conform to PEP 8. So I guess it is impossible
to have a single naming style in Python.

For these two reasons, I think its so much more important to be consistent
within a project, rather than to stick with PEP 8. When you are using a
module, you'll see in no-time what style is used, and you're able to use it.
The fact that some standard modules deviate from PEP 8 without problems
shows it.

Personally, I prefer CamelCase over under_scores.

Almar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080915/0dbc6d1f/attachment.html>


More information about the Python-list mailing list