Who has not stumbled across this quote "we are all consenting adults here" in the Python community, yet? Unlike in other languages like C++ (sorry, there are many more, but that's one I am most familiar with), we can't really protect class methods from being used outside the class (i.e., by the API user).

All we can do is indicate methods as private to make clear that they are not to be used outside the class, but it really is up to the class user, since "we are all consenting adults here"!

So, when we want to mark a class method as private, we can put a single underscore in front of it.

If we additionally want to avoid name clashes with other classes that might use the same method names, we can prefix the name with a double-underscore to invoke the name mangling.

This doesn't prevent the class users to access this class member though, but they have to know the trick and also know that it is at their own risk...

Let the following example illustrate what I mean: