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

后端 未结 13 2444
生来不讨喜
生来不讨喜 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:32

    The Google Python Style Guide has the following convention:

    module_name, package_name, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name.

    A similar naming scheme should be applied to a CLASS_CONSTANT_NAME

提交回复
热议问题