Good. I think I understood the use of one and two underline headers in Python.
Correct me if I am wrong
In the case of one underscore, the underscore prevents the operator from from X import *importing such variables.
from X import *
In the case of two underscores, the variable name is appended with the name of the class to which it belongs to ensure a higher level of "privacy".
Now my question is: why not use only two underscores? When is one underscore preferable (or necessary) over two underscores?
: , ( ).
:
" " (, , , ) Python "" Java. , , API //. ( - , , Python, ?), , - (. " , " ).
. - , ( ): . django ( django.utils.functional).
, , , 15 , , .
.
1. Single Underscore
PEP-8:
_single_leading_underscore: " ". . from M import * , .
from M import *
2. Double Underscore:
Python:
__spam ( , ) _classname__spam, classname - . , , , , , , . . , "private", , , . , ; , , .
__spam
_classname__spam
classname
Source: https://habr.com/ru/post/1667347/More articles:Silver finder can get PATTERN from file? - command-lineLimit number of positions in Quantstrat - rToday, the extension with UICollectionView is different compared to Single View - ioschange color DatePicker [Xamarin.Forms] - background-colorHow to compile Mac with Linux? - ubuntuPerformance Statements - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1667349/adding-bower-components-to-vue-webpack&usg=ALkJrhjd7WOV-a0HSJAiWs9UZzMofzqizgПоле ввода с каналом не обновляет значение при удалении пространства - angularФиксация ERR_INCOMPLETE_CHUNKED_ENCODING в JAVA Spring/angular Запрос JS GET - javaJava 8 stream - reference to the source stream object after a flat map - javaAll Articles