Year: 2024
Type: conference-paper
Abstract: The Python language has no unrestricted goto statement, but because of Python’s deep introspection capabilities, along with its dynamic nature, an unrestricted goto can be added to the language by rewriting a function’s bytecode at runtime. Two primary use cases for goto in Python are discussed: porting existing historic code to Python while maintaining the existing code’s flavour, and implementing state machines. While theoretically unnecessary, goto can make the first case easier, and the second case faster. An implementation is described and performance tests on an example state machine show using goto is a very fast method of implementing state machines in Python, and existing efforts to port historic code are already using the goto implementation.
DOI: 10.34074/proc.240119
Author: Carl Cerecke
Institution: Unitec Institute of Technology
Language: English
Subfield: Software
Field: Computer Science
Domain: Physical Sciences
Open Access status: bronze
OpenAlex ID: W4400965628
