ZZ from http://blog.163.com/yang_jianli/blog/static/1619900062011627103516435/
_xxx cannot be imported with ' from module import * '
__xxx__ System Definition Name
Private variable names in the __xxx class
Core style: Avoid using underscores as the start of variable names.
A member variable that starts with a "single underline" is called a protection variable, meaning that only class objects and subclass objects can access these variables themselves;
A "double underline" begins with a private member, meaning that only the class object can access it, and the child object cannot access the data.
A class attribute that begins with a single underscore (_foo) cannot be accessed directly, and is accessed through the interface provided by the class, cannot be imported with a "from XXX import *", and a double underscore (__foo) represents a private member of the class; A double underscore that starts and ends (__foo__ Represents a special method-specific identifier for Python, such as __init__ (), which represents the constructor of a class.
Conclusion:
1. _xxx, which begins with a single underscore, is a variable of type protected. That is, the protection type can only allow access to its own and subclasses. Weak internal variable markers, such as when using "from M import", do not introduce an object that begins with an underscore.
2, __xxx double underline is a variable of the private type. Can only be allowed to access the class itself, and even subclasses can not be used to name a class attribute (class variable), called when the name is changed (inside the class FooBar, __boo into _foobar__boo , such as Self._foobar_ _boo )
)
3. __xxx___ defines the method of the special column. Variables or attributes within a user-controlled namespace, such as __init__,__import__ or __file__. Do not define such variables yourself unless the document is described. (that is, these are the variable names defined within Python)
Meaning of the Python underline variable