Skip to content

Just what it sounds like, decorator that patches function bytecode to allow GOTO's *ROFL* As part of what I call the "How it's made - Software edition"

License

Notifications You must be signed in to change notification settings

izo0x90/Adding-GOTO-statement-to-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adding GOTO statement into Python

"Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should." - That JURASSIC PARK guy

You guys remember basic.

Just what it sounds like, a decorator that patches the bytecode of a decorated function to allow variable assignments to specific string constants to be treated as GOTO/JUMP statements and LABELS to jump to.

Just in case it needs to be said, yes this is a joke and has no actual uses, nor should anyone use it for anything real other than having fun.

All relevant code in main.py.

Live REPL demo here: https://replit.com/@HristoGueorguie/Adding-GOTO-statement-to-Python-cue-eveil-laughter.


Links to refs:

https://rushter.com/blog/python-bytecode-patch/ - Patching bytecode article by Artem Golubin

https://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html - Python Interpreter in Python article by Allison Kaptur

About

Just what it sounds like, decorator that patches function bytecode to allow GOTO's *ROFL* As part of what I call the "How it's made - Software edition"

Topics

Resources

License

Stars

Watchers

Forks

Languages