What is the naming convention in Python for variable and function names?

后端 未结 13 2310
生来不讨喜
生来不讨喜 2020-11-22 08:50

Coming from a C# background the naming convention for variables and method names are usually either camelCase or PascalCase:



        
13条回答
  •  逝去的感伤
    2020-11-22 09:25

    David Goodger (in "Code Like a Pythonista" here) describes the PEP 8 recommendations as follows:

    • joined_lower for functions, methods, attributes, variables

    • joined_lower or ALL_CAPS for constants

    • StudlyCaps for classes

    • camelCase only to conform to pre-existing conventions

提交回复
热议问题