Because it's a fun exercise to understand the internals of CPython. That's what hacking is all about.
Because goto can be useful?
You are not a Python programmer for sure :)
In e.g. fortran there are labelled loops. So one can break out of an inner loop back to the main program flow. I know that this wouldn't be pythonic but sometimes I just want to finish the one off script and get back to something more fun and I miss this ability. I still don't think arbitrary gotos are great.
You can resolve this in basically every language by reworking your code in smaller pieces, and simply returning from a loop. Jumping left and right should only be signalling that you are Doing It Wrong (tm)
Can you do that without causing performance degradation e.g. through cache thrashing though? Fortran performance can vary significantly when you move stuff around.
I know this. As a said I would use this for one off scripts if it existed. (I'm not about to add a dependency to all my one off scripts though.)
I've seen exceptions masquerading as goto in the wild in multiple python codebases (and not because I added them). `raise HttpResponse(status=401, body="unauthorized")` inside some utility method is little more than goto exit in a lot of C code.
Using Exceptions this way in Python code is common practice and considered "Pythonic" and it's different than goto:
- an Exception only can bubble up the call stack, not to an arbitrary location in the code
- it can be caught whatever level during that path