GOTO (was Re: Appeal for python developers)

beliavsky at beliavsky at
Sat Mar 5 17:00:23 CET 2005

Torsten Bronger wrote:
> Hallöchen!
> > Please include "goto" command in future python realeses I know
> > that proffesional programers doesn't like to use it, but for me as
> > newbie it's too hard to get used replacing it with "while", "def"
> > or other commands
> Accordings to Stroustrup's C++ book, the only good reason for goto
> statements in a language is to have it in computer-generated code.
> I don't know whether programs generate Python, but I *think* that
> even there "goto" can be avoided very easily.

Goto is useful in breaking out of a nested loop and when there is a
clean-up section of a function that should be executed for various
error conditions.

In another newsgroup I once asked "who needs GOTO" and got some good
answers -- the thread can be found by Googling 'beliavsky at
"explicit GOTO"'. Goto's are less dangerous when they are in the
forward direction, to code appearing later.

More information about the Python-list mailing list