"Goto" statement in Python

Chris Angelico rosuav at gmail.com
Fri Apr 14 10:17:18 EDT 2017

On Sat, Apr 15, 2017 at 12:13 AM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Thu, 13 Apr 2017 18:36:57 -0600, Ian Kelly <ian.g.kelly at gmail.com>
> declaimed the following:
>>Well, you can do it in Assembly. And BASIC, if you count the primitive
>>GOSUB-type subroutines, though modern BASICs have real subroutines
>>that don't allow it.
>         REXX probably allows it too... (No GOTO, but the SIGNAL statement can
> do unconditional jumps to named labels)... Hmmm, if I read the manual
> correctly, any use of SIGNAL will terminate loops, even if the SIGNAL and
> target are both within the same loop.

This is correct. Annoyingly, it also wipes out indentation in the
TRACE output, so you really want to use it *only* for error handling
(which is its stated purpose).


More information about the Python-list mailing list