3 ms·
From the opening paragraph of the readme.md > MacroPy provides a mechanism for user-defined functions (macros) to perform transformations on the abstract synta
by shawabawa3 13y ago
From the opening paragraph of the readme.md
> MacroPy provides a mechanism for user-defined functions (macros) to perform transformations on the abstract syntax tree(AST) of Python code at module import time
Basically it rewrites the code before it's compiled, so no, x and y don't need to exist (compilation hasn't finished when the macro runs)
- cheez 13y agoDecorators can do this? I did not know this. I thought decorators just get handed the object after initialization, so something like: @blah class Lol: pass is equivalent to: class Lol: pass blah(Lol) What am I missing?