Skip to content

Instantly share code, notes, and snippets.

@superbobry
Created January 23, 2018 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superbobry/218214191f20735117345ceb89a6d46e to your computer and use it in GitHub Desktop.
Save superbobry/218214191f20735117345ceb89a6d46e to your computer and use it in GitHub Desktop.
Python name mangling
>>> class A:
... def __init__(self, __foo):
... print(__foo)
...
>>> dis.dis(A.__init__)
3 0 LOAD_GLOBAL 0 (print)
2 LOAD_FAST 1 (_A__foo)
4 CALL_FUNCTION 1
6 POP_TOP
8 LOAD_CONST 0 (None)
10 RETURN_VALUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment