Underscore Naming原文: https://www.xingyulei.com/post/py-dunder/
Single Leading Underscore:
_var
Indicating a name is protected, for internal use、Not enforced by python interpreter
Double Leading Underscore:
__varIndicating a name is private、Enforced by interpreter, attempt to call it will trigger AttributeError
Double Leading Trailing Underscore:
__var__Special methods (magic methods) defined by python language, avoid naming your own attribute
Single Trailing Underscore:
var_Avoid naming conflict with python keywords
Single Underscore:
_Temporary variable name, variables that are never usedExample:
a, b, c, d = ([] for _ in range(4))for _ in random_list: some_operation()
ReferenceDan Bader - The Meaning of Underscores in Python
Tutorials Teacher - Python - Public, Protected, Private Members