Hacker GitHub

← All repos

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

Mentions per year 9 mentions · busiest year 2015 (5)
20082026
  1. …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.
  2. …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
  3. ▲ 197
    A function decorator that rewrites the bytecode to enable goto in Python
    story by sea6ear · 2021-09-21 · 88 comments
  4. ▲ 3
    Python-goto: A function decorator that implements goto by rewriteing bytecode
    story by segfaultbuserr · 2020-06-25 · 0 comments
  5. 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
  6. …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
  7. …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
  8. …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
  9. ▲ 170
    Goto in Python
    story by wallunit · 2015-09-21 · 43 comments