*Naming Conventions*
Dan Bishop
danb_83 at yahoo.com
Sun Jun 3 19:20:53 EDT 2007
On Jun 3, 11:03 pm, Thorsten Kampe <thors... at thorstenkampe.de> wrote:
> Okay,
>
> I hear you saying 'not another naming conventions thread'. I've read
> through Google and the 'naming conventions' threads were rather
> *spelling conventions* threads.
>
> I'm not interested in camelCase versus camel_case or anything
> mentioned in 'PEP 8 -- Style Guide for Python Code'. What I'm looking
> for is hints or ideas how to name your variables and especially how to
> name functions, methods and classes.
In my code:
* The most common form of a function/method name is verb_noun. Other
common patterns are adjective_noun, noun_to_noun or noun2noun (for
conversions), and noun_of_noun.
* Classes nearly always have AdjectiveNoun names.
* Loop indices often have single-letter names (typically i/j/k or x/
y), or names that are the singular form of the list name (e.g., "for
ballot in self._ballots"). For iterating over files, I use "line".
More information about the Python-list
mailing list