method names nounVerb or verbNoun

Gerald Britton gerald.britton at gmail.com
Fri Feb 5 15:00:45 EST 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
> verbNoun?
>
> 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.
>
> Thanks
> --
> http://mail.python.org/mailman/listinfo/python-list
>

I'd say noun_verb (note the underscore in accordance with the style
guide in PEP 8):

http://www.python.org/dev/peps/pep-0008/

Function Names

      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.

-- 
Gerald Britton



More information about the Python-list mailing list