snoack/python-goto
View on GitHub ↗ ★ 1,304 Python archived
Discontinued function decorator that rewrites Python bytecode to enable goto statements
9 mentions on Hacker News by 6 people: 3 stories, 6 comments · first 2015-09-21 · latest 2024-02-12
20082026
-
…written by ChatGPT. The feature has been implemented a few times as a joke (more or less), e.g. https://github.com/snoack/python-goto/ , but that one at least hasn't been updated for 5 years.
comment by Retr0id · 2024-02-12 · in Show HN: Bitwise Liminal – A Short Film in 256 Bytes of Code -
…hacks like using hooks intended for debuggers < https://entrian.com/goto/ > or rewriting bytecode < https://github.com/snoack/python-goto >, and frankly what Svelte does is quite similar, just implemented as a compilation step rather than…
comment by chrismorgan · 2023-09-04 · in Svelte is surprisingly easy to learn -
▲ 197
A function decorator that rewrites the bytecode to enable goto in Pythonstory by sea6ear · 2021-09-21 · 88 comments
-
▲ 3
Python-goto: A function decorator that implements goto by rewriteing bytecodestory by segfaultbuserr · 2020-06-25 · 0 comments
-
Fixed: https://github.com/snoack/python-goto/commit/a46dbe57e9cfa4f... Jumps out of loops and other blocks work now. However, there are some limitations: 1. As I only have 4 bytes left to inject POP_BLOCK instructions, you can't exit more…
comment by wallunit · 2015-09-22 · in Goto in Python -
…JUMP_FORWARD isn't any faster than 7 NOPs. In Python 2.7, JUMP_FORWARD is even slower. So reverted: https://github.com/snoack/python-goto/commit/d19d244a9e5efdf... Thanks for the pointer!
comment by wallunit · 2015-09-21 · in Goto in Python -
…the gap, these however are never executed as they are skipped by the preceding jump instruction. https://github.com/snoack/python-goto/commit/2b0f5e5069cbb88...
comment by wallunit · 2015-09-21 · in Goto in Python -
…itself[1] is very understandable. I'm sure neither should be used in a production project. [1]: https://github.com/snoack/python-goto/blob/master/goto.py
comment by mrsirduke · 2015-09-21 · in Goto in Python -
▲ 170
Goto in Pythonstory by wallunit · 2015-09-21 · 43 comments