-
[项目名]
全小写,短横线分隔。
pytest pytest-html
-
[包名/模块名]
全小写,下划线分隔,动_宾结构。
fixtures collect_pytest_prefix
-
[函数名/方法名/变量名]
全小写,下划线分隔,动_宾结构。
def validate_pep8(self):
-
[注释/打印/日志]
全英文,首字母大写。
# This is a comment # This is a print # This is a log
-
[关键字冲突/模块名冲突/包名冲突]
单下划线后缀,比加个单词简洁。
vars_
-
[私有]
考虑object公有/私有,私有的加单下划线前缀。
_formatter def _convert_data_type(self):
-
[临时变量]
简单逻辑的临时变量,单个字母。
def parse_changelog(tag_name): p = Path(__file__).parent.parent / "doc/en/changelog.rst" changelog_lines = p.read_text(encoding="UTF-8").splitlines()
-
[get/set]
避免只用get/set,还有更多词汇。
object list_objects count save/insert remove/delete update batch
Python如何命名“看起来”更简洁规范逼格
猜你喜欢
转载自www.cnblogs.com/df888/p/12659023.html
今日推荐
周排行