I'm reading a book on Python, and it says that when you make a call to help(obj)
to list all of the methods that can be called on obj
, the methods that are surrounded by __
on both sides are private helper methods that cannot be called.
However, one of the listed methods for a string is __len__
and you can verify that if s
is some string, entering s.__len__()
into Python returns the length of s
.
Why is okay to call some of these methods, such as __len__
, but others cannot be called?