<div><div>To make a method or attribute private (inaccessible from the outside), simply start its </div><div>name with two underscores</div><div><br></div><div>----《Beginning Python From Novice to Professional》</div><div><br></div><div>but there is another saying goes:</div><div>Beginning a variable name with a single underscore indicates that the variable should be treated as ‘private’.</div><div><br></div><div>I test both these 2 rules ,it seems only names that start with two underscores are REAL private methods or attributes .</div><div><br></div><div>>>> class A:</div><div>...     def __init__(self):</div><div>...         self.a = 'a'</div><div>...         self._a = '_a'</div><div>...         self.__a = '__a'</div><div>...</div><div><br></div><div><br></div><div><br></div><div>>>> ap = A()</div><div>>>> ap.a</div><div>'a'</div><div>>>> ap._a</div><div>'_a'</div><div>>>> ap.__a</div><div>Traceback (most recent call last):</div><div>  File "<stdin>", line 1, in ?</div><div>AttributeError: A instance has no attribute '__a'</div><div><br></div><div>so what is your opinion about single leading underscore and private methods or attributes?</div></div>