Python 风格指南

https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/contents/

目前个人遵循的基本规范:

class 的名字首字母全部大写,采用大驼峰方式

class MyDb:
    pass

常量以及路径等的变量统大写字母

NUM = 100
CONFPATH = xxx

函数名以及方法名统一用小写,下划线隔开

def convert_to_str():
    pass

一行不超过 80 个字符,除超长的模块名字以及注释里面的 url

原文地址:https://www.cnblogs.com/xiaowenshu/p/11211626.html