The meaning of single underline and double underline in python

The meaning of single underline and double underline in python The meaning of single underline and double underline in python P Y T H O n- in a single lower draw lines and double the draw line is intended to sense

__init__: A convention, Python internal name, used to distinguish other user-defined names to prevent conflicts.
_major: A convention used to specify private variables. The name in the class with a leading underscore only indicates to other programmers that the attribute or method is private, but the name itself has nothing special
__major.: This has a real meaning: the parser replaces the name with _classname__major to The difference is the same naming as other classes.

Guess you like

Origin blog.csdn.net/qq_41375318/article/details/115216497