[Python-ideas] Jump to function as an an alternative to call function

Steven D'Aprano steve at pearwood.info
Wed Aug 15 21:34:58 EDT 2018


On Wed, Aug 15, 2018 at 08:35:35PM -0400, David Mertz wrote:

> Goto considered harmful.

Fortunately this proposal has nothing to do with goto.

Elazar is correct that its a kind of subroutine call, just like an 
ordinary function call, except the scoping rules are different.

And for the record, not everyone agrees that Dijkstra is correct about 
goto. Certainly unstructured code is harmful, but we use restricted 
forms of goto all the time, we just don't call it by that name:

- loops
- continue
- break
- if...else
- function calls
- exception handling

Just like goto, these are all jumps which change the execution order of 
your code. And some people defend limited, careful use of explicit goto, 
including Donald Knuth.


-- 
Steve


More information about the Python-ideas mailing list