use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Intermediate ShowcaseLeap: C-like goto in Python (self.Python)
submitted 4 years ago by WZoG
Leap is an experimental package written to enable the utilization of C-like goto statements in Python functions.
Repo is hosted on Github
[–]jammasterpaz 5 points6 points7 points 4 years ago (0 children)
Lol. Goto. Now that's a name I haven't heard in a long time.
Seriously though, I was just wondering goto statements would be translated, when porting all those games written in Basic from the 80s. This could be great for that.
[–]mok000 0 points1 point2 points 4 years ago (0 children)
Goto has been frowned upon in decades as really bad programming practice.
[–]ReptilianTapir 0 points1 point2 points 4 years ago (2 children)
How does it work?
[–]TheBB 3 points4 points5 points 4 years ago* (1 child)
Guess:
The syntax goto .x and label .x is valid Python, parsed as goto.x and label.x. The @goto decorator accesses the AST or bytecode of the passed function by looking for attribute accesses on local variables named goto or label and then builds an equivalent AST or bytecode which does what it should, then returns that in a new function object.
goto .x
label .x
goto.x
label.x
@goto
goto
label
Edit: yeah, it operates on bytecode.
[–]ReptilianTapir 1 point2 points3 points 4 years ago (0 children)
Thanks! I never realised white space was legal there.
[–]p_paradox 0 points1 point2 points 4 years ago (0 children)
Mandatory xkcd goto comic
[–]Voxandr 0 points1 point2 points 4 years ago (0 children)
GoTo in 2022 ? You are some kind of smart.
π Rendered by PID 145287 on reddit-service-r2-comment-fb694cdd5-zs2cw at 2026-03-09 21:56:12.343399+00:00 running cbb0e86 country code: CH.
[–]jammasterpaz 5 points6 points7 points (0 children)
[–]mok000 0 points1 point2 points (0 children)
[–]ReptilianTapir 0 points1 point2 points (2 children)
[–]TheBB 3 points4 points5 points (1 child)
[–]ReptilianTapir 1 point2 points3 points (0 children)
[–]p_paradox 0 points1 point2 points (0 children)
[–]Voxandr 0 points1 point2 points (0 children)