Request for help on naming conventions

Benjamin Niemann pink at odahoda.de
Mon Jun 13 08:28:47 EDT 2005


Steven D'Aprano wrote:

> Are there any useful naming conventions for modules, classes and
> functions?
> 
> For instance, should I name functions as verbs and classes as nouns?
> 
> eg
> class Transformer():
>     pass
> 
> def transform():
>     do_stuff
> 
> What about the module name? transformations.py or transform.py?
You probably want to read the PEP 8, "Style Guide for Python Code":
http://www.python.org/peps/pep-0008.html


> What do people do with their own code? Do folks find that being
> consistent helps them remember what is what, or do you name objects
> whatever feels right at the time?
Naming convention are mostly a matter of personal taste (unless you are
working in a larger team, where there are some official conventions that
must be followed). So I would say the 'feels right' is the most important
factor.

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/



More information about the Python-list mailing list