Python Forum
adding goto to Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
adding goto to Python
#1
goto is one of the fastest computer programming operations around, at least if we don't actually use it. what if Python had a goto statement/keyword?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Python would have lot of spaghetti code (this is not my opinion but BDFL himself):

Quote:since TCO essentially is a GOTO, you write spaghetti code using TCO just as easily
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
noop is much safer than goto.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
I would probably still program Python, but I would not be on this board. If Python had goto, newbies would use it all the time, they would use it wrong all the time, and we would spend all our time fixing goto issues. No thanks.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
Goto statement in Python could be and is already implemented by bytecode-injection; You can try it by installing goto-statement module. So, if someone wish, they can install it and take a feeling how to write code in Python with goto statement. Note, that goto-statement is a joke module, don't use it when doing something worth.
Reply
#6
(Apr-09-2019, 04:24 AM)Skaperen Wrote: goto is one of the fastest computer programming operations around, at least if we don't actually use it.

Not sure if serious.. Huh
Reply
#7
I personally admire many of Dijkstra's writings due to his ability to explain in spoken language fundamental challanges in programming.

Edgar Dijkstra: Go To Statement Considered Harmful
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#8
https://youtu.be/dqu7PTwb0go

More or less :-)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
In case you want to actually use it, there was an April fool's module written which adds goto support for python:
http://entrian.com/goto/

However, it is NOT fast. The way it works, is it installs an exception handler, and when a syntax error is raised for "goto" (since that's not a real keyword), it redirects the debugger to continue execution at the specified label.
Reply
#10
I didn't even like to use goto equivalents in assembly language, using CALL instead of JMP whenever possible, which like python is almost all of the time.
The only JMP in most of my code was during bootstrap operations.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020