Created
September 9, 2011 11:46
-
-
Save albertz/1206010 to your computer and use it in GitHub Desktop.
Python function name mangling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: class Test: | |
...: def __foo(self): pass | |
...: | |
...: | |
In [2]: dir(Test) | |
Out[2]: ['_Test__foo', '__doc__', '__module__'] | |
In [3]: Test.__foo | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
/Users/az/<ipython console> in <module>() | |
AttributeError: class Test has no attribute '__foo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment