wtfpython
wtfpython copied to clipboard
Another mangling example
>>> def __greet():
... print("hello")
...
>>> __greet()
hello
>>> class C:
... def run(self):
... __greet()
...
>>> C().run()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in run
NameError: name '_C__greet' is not defined
Interesting, I'm wondering what should be the right way to call __greet inside the run method then