Reserved classes of identifiers
Certain classes of identifiers (besides keywords) have special meanings. These classes are identified by the patterns of leading and trailing underscore characters:
_name #
_name (single leading underscore)
Not imported by “from module import *”.
Also the special identifier “_” is used in the interactive interpreter to store the result of the last evaluation; it is stored in the __builtin__ module. When not in interactive mode, “_” has no special meaning and is not defined. See import.
Note: The name “_” is often used in program code in conjunction with internationalization; refer to the documentation for the gettext module for more information on this convention.
__name__ #
__name__ (double leading and trailing underscores)
System-defined names. These names are defined by the interpreter and its implementation (including the standard library); applications should not expect to define additional names using this convention. The set of names of this class defined by Python may be extended in future versions. See special-method-names.
__name #
__name (double leading underscores)
Class-private names. Names in this category, when used within the
context of a class definition, are re-written to use a mangled form to
help avoid name clashes between private
attributes of base and
derived classes. See identifiers.
