Python 下划线命名约定

http://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles

_single_leading_underscore: weak “internal use” indicator. E.g. from M import * does not import objects whose name starts with an underscore.

_单下划线打头 : 表示“内部使用”。比如: from M import * 将不会导入一个下划线打头的对象。单下划线结尾_ : 意味着避免和关键字冲突, 比如 Tkinter.Toplevel(master, class_='ClassName')__双下划线打头 : 编译阶段会家里上类名前缀,比如 在类 FooBar 中,__boo 对象在编译后会变为 _FooBar__boo __双下划线包围__ : 意味着这是一个魔法对象或用户自定义的空间,比如 __init____import____file__ 。不要重新定义这些名称,只将他们按照文档上的规定使用。

Python 下划线命名约定

相关文章:

你感兴趣的文章:

标签云: