python - 我应该在 Python 中使用 "camel case"还是下划线?

那么哪个更好,为什么?

def my_function():

def myFunction():

最佳答案

有关 Python 样式指南的所有内容:我建议您阅读 PEP8 .

回答你的问题:

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

关于python - 我应该在 Python 中使用 "camel case"还是下划线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8908760/

相关文章:

python - Django:显示选择值

linux - 递归查找具有特定扩展名的文件

linux - chmod 777 到一个文件夹和所有内容

python - Python 和 IPython 有什么区别?

python - 在 Python 中以 YYYY-MM-DD 获取今天的日期?

python - Python进程使用的总内存?

linux - 在shell中获取程序执行时间

python - Python 是强类型的吗?

linux - 如果任何命令返回非零值,则中止 shell 脚本

linux - 使用sudo时如何保留环境变量