"Name mangling" (so called) was't meant to be confused with the concept of "privacy". It's a common misconception. It's in the language to help to mitigate the problem of class field name collisions while the inheritance comes into the game. Think of the __slots__ class attribute or any API-like class mechanics using both inheritance and class fields (Django models). You may want to have each subclass add its value to the mechanics, not to override superclasses' values.
There is no concept of private variables in Python. So "__" is just the convention followed to achieve similar concept.
"Name mangling" (so called) was't meant to be confused with the concept of "privacy". It's a common misconception. It's in the language to help to mitigate the problem of class field name collisions while the inheritance comes into the game. Think of the
__slots__
class attribute or any API-like class mechanics using both inheritance and class fields (Django models). You may want to have each subclass add its value to the mechanics, not to override superclasses' values.Wait. Isn't it exactly what I said?
And besides, many developers (including me) prefers a single underscore, even though it has no meaning for Python.