method names nounVerb or verbNoun
gerald.britton at gmail.com
Fri Feb 5 21:00:45 CET 2010
On Fri, Feb 5, 2010 at 2:53 PM, Wanderer <wanderer at dialup4less.com> wrote:
> Which is the more accepted way to compose method names nounVerb or
> For example voltageGet or getVoltage? getVoltage sounds more normal,
> but voltageGet is more like voltage.Get. I seem to mix them and I
> should probably pick one way and stick with it.
I'd say noun_verb (note the underscore in accordance with the style
guide in PEP 8):
Function names should be lowercase, with words separated by underscores
as necessary to improve readability.
mixedCase is allowed only in contexts where that's already the
prevailing style (e.g. threading.py), to retain backwards compatibility.
More information about the Python-list