我应该使用“骆驼皮"吗?或在Python下划线? [英] Should I use "camel case" or underscores in python?

查看:69
本文介绍了我应该使用“骆驼皮"吗?或在Python下划线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那哪个更好,为什么呢?

So which is better and why?

def my_function():

def myFunction():

推荐答案

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

for everything related to Python's style guide: i'd recommend you read PEP8.

回答您的问题:

函数名称应小写,单词之间用逗号分隔 强调必要以提高可读性.

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

这篇关于我应该使用“骆驼皮"吗?或在Python下划线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆