Python core style: Avoid using underscores as the start of variable names.
Because underscores have special meanings for the interpreter and are symbols used by built-in identifiers, we recommend that programmers avoid using underscores as the starting point for variable names. In general, variable name _xxx is considered " private "and cannot be used outside of a module or class. When a variable is private, it is good practice to use _xxx to represent variables. Because the variable name __xxx__ has a special meaning for Python, this naming style should be avoided for common variables.
"single underline "
A member variable that starts with a "single underline" is called a protection variable, meaning that only class objects and self-class objects can access them themselves.
Example: A single underscore (_foo) represents a class attribute that cannot be accessed directly, and must be accessed through the interface provided by the class, and cannot be imported with "from XXX import *" .
" double underline "
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.
Example: A Double underscore (__foo) represents a private member of a class; a double underscore (__foo__) that begins and ends with a python The special method-specific identifier, such as __init__(), represents the constructor of the class.
Python the variable name that begins with the underscore meaning