A function decorator that rewrites the bytecode to enable goto in Python

#62 · 🔥 195 · 💬 88 · 2 years ago · github.com · sea6ear · 📷
Begin is regular Python syntax to retrieve the attribute begin from the objects with the variable names label and goto. In the example above these variables aren't defined. There is another module that has been released as April Fool's joke in 2004. That implementation doesn't touch the bytecode, but uses a trace function, similar to how debuggers are written. While this eliminates the need for a decorator, it comes with significant runtime overhead and a more elaborate implementation. Modifying the bytecode, on the other hand, is fairly simple and doesn't add overhead at function execution.
A function decorator that rewrites the bytecode to enable goto in Python



Send Feedback | WebAssembly Version (beta)