dav*_*vid 6 python
双下划线在python中表示什么?我记得读过一个教程,说它与隐藏变量有关,但我觉得它还有更多的东西,我不断看到有双重下划线的代码示例,我不明白这意味着什么.
Mar*_*som 7
从PEP 8:
__double_leading_underscore:当命名一个类属性时,调用名称修改(在类FooBar中,__boo变为_FooBar__boo;见下文).
__double_leading_underscore
__boo
_FooBar__boo
__double_leading_and_trailing_underscore__:生成在用户控制的命名空间中的"魔术"对象或属性.例如__init__,__import__或__file__.不要发明这样的名字; 只记录使用它们.
__double_leading_and_trailing_underscore__
__init__
__import__
__file__
归档时间:
12 年,2 月 前
查看次数:
8321 次
最近记录: