5 ms·
With a decorator you can parse and rewrite the function's bytecode. If it helps, I'm fairly sure you could also ask for the function's abstract syntax tree, rew
by tom_mellior 6y ago
With a decorator you can parse and rewrite the function's bytecode. If it helps, I'm fairly sure you could also ask for the function's abstract syntax tree, rewrite that, and ask for it to be compiled. So you could build something, but every function using such gotos would have to be decorated with @gotos or whatever.
- fezzez 6y ago^To add to that. I'm doing exactly that to build this tool that lets you add logging statements onto running python without any restarts. CPython gives you all the necessary utilities to let you freely manipulate pretty much any function's bytecode.