Created
June 9, 2016 02:46
-
-
Save zackmdavis/d46c19499620eb7b16ceb7d9e0e21d6a to your computer and use it in GitHub Desktop.
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]: import ast; from ast import * | |
in [2]: m = ast.parse('def at(): print("@")') | |
in [3]: m.body[0].name = "@" | |
in [4]: exec(compile(m, "<string>", 'exec')) | |
in [5]: globals()['@'] | |
Out[5]: <function __main__.@> | |
in [6]: globals()['@']() | |
@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment