A function decorator, that rewrites the bytecode, to enable goto in Python
Project description
Installation
make sure you are using python 3.9
pip install -U goto-label
NOTE: support for python >=3.10 is very unstable.
Usage
a simple example:
from goto import with_goto
from goto import goto, label # optional, for linter purpose
@with_goto
def x():
goto .end
print("this will not print")
label .end
print("this will print")
- use
label .NAME
to define a label. - use
goto .NAME
to goto into a label.
Thanks
this project was inspired by snoack/python-goto .
since the project seems to have been discontinued, I created this.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
goto-label-0.1.0.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for goto_label-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e15681cc197b4f97bba15f8de5ec911336c8f28fabbeb8d1f736682716373b04 |
|
MD5 | b5199a610171fe776d9dce65b5ad5d35 |
|
BLAKE2b-256 | ddd03ac959f132fbcf07561ab701efaad809eab2cd1905427914653bfc215b10 |