python in single underline, the double underline, and both ends of the double underline

1. In the python interpreter, _ is the results of the previous statement, it was first CPython implementation, and now other types of interpreters are also using
the results of the above statements 2. The ten lines of print hello world on the screen, we do not need these numbers 0-9, so no need to give him a variable name '_'
3. single underline: single underlined variables are beautiful agreement between one kind of programmers - as long as this is not just variables outside the class to access it! ! !
But if we look at the single module import underlined the beginning of the variables, it is not the same, here's the name of this particular variable becomes a module similar to the one kind of "private" variables, because we use from the name of the module import * statement when importing modules, these variables are single underscore the default will not be imported, so in fact this has impact on the single underline python interpreter.
5. Double underline: parser automatically converted to: _ __ members of the class name names, instead of the original members, plus the need to access the class name _ before the original member name. Such as: Python automatically __name interpreted as _student__name, we can use _student__name access

Guess you like

Origin www.cnblogs.com/duoduoyichen/p/11100128.html