Consider the following class
class Foo(object):
@staticmethod
def __is():
print('__is')
def m(self):
Foo.__is() # executes
Foo.__is() # fails because of mangling
print(Foo.__dict__.keys())
Foo.__is()
when it is run after the class is defined, it fails because of name mangaling. How is python interpreter able to resolve Foo.__is()
inside methods but not outside the class?