关于命名约定:我应该在python中使用”camel-case”还是下划线?

Should I use “camel case” or underscores in python?

本问题已经有最佳答案,请猛点这里访问。

那么哪个更好,为什么呢?

1
def my_function():

1
def myFunction():


关于python风格指南的所有相关内容:我建议您阅读pep8。

要回答您的问题:

Function names should be lowercase, with words separated by
underscores as necessary to improve readability.


PEP8建议第一种形式的可读性。你可以在这里找到它。

Function names should be lowercase, with words separated by
underscores as necessary to improve readability.


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

查看它已被应答,单击此处