https://github.com/google/styleguide/blob/gh-pages/pyguide.md
命名样例
类别 | 公开的 | 内部的 |
Packages | lower_with_under | |
Modules | lower_with_under | _lower_with_under |
Classes | CapWords | _CapWords |
Exceptions | CapWords | |
Functions | firstLowerCapWords() | _firstLowerCapWords() |
Global/Class Constants | CAPS_WITH_UNDER | _CAPS_WITH_UNDER |
Global/Class Variables | lower_with_under | _lower_with_under |
Instance Variables | lower_with_under | _lower_with_under (protected) or __lower_with_under (private) |
Method Names * | firstLowerCapWords() | _firstLowerCapWords() (protected) or __firstLowerCapWords() (private) |
Function/Method Parameters | lower_with_under | |
Local Variables | lower_with_under |
* 考虑只在首选项设置中使用对公开属性的直接访问来作为 getters 和 setters,因为函数调用在 Python 中是比较昂贵的,而 property 之后可以用来把属性访问转化为函数调用而无需改变访问语法。