"Goto" statement in Python

Ian Kelly ian.g.kelly at gmail.com
Thu Apr 13 17:58:57 EDT 2017

On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Thu, 13 Apr 2017 15:52:24 +0100, bartc <bc at freeuk.com> declaimed the
> following:
>>'goto' would be one easy-to-execute byte-code; no variables, objects or
>>types to worry about. If implemented properly (with the byte-code
>>compiler using a dedicated name-space for labels) there would be no name
>         Only if GOTO is not allowed to break out of namespaces...
>         NO GOTO from inside a function to some global catch-all handler... No
> GOTO from a global scope into a non-global scope.
>         Once you permit uncontrolled/unlimited GOTO you have to be concerned
> with stack-frames and object life-times.

Even within a function you would still have to be concerned about a
goto from inside a try or with block to outside of that block, as the
finally block or the context manager's __exit__ still need to be
executed on the way out.

Not to mention the time-honored tradition of using goto to jump INTO a
block, such as Duff's Device.

More information about the Python-list mailing list