Goto

Mikhail V mikhailwas at gmail.com
Fri Dec 29 20:02:08 EST 2017


MRAB wrote:


> It's OK for code that's close to the metal, but in high-level code? No.
> Python has managed for >25 years without it, and I've yet to see a
> convincing use-case.

"convincing" is a broad term I think, especially for syntax proposals ;)

I think often one wish to use it just to avoid "if" blocks in
obvious situations - no need to setup flags and  indent/unindent code blocks.

Apart from that, I personally would prefer it in such typical code:

if a :
    a()
    goto "end"
if b :
    b()
    goto "end"
if c :
    c()
    goto "end"
"end"

I know I can do it with "elif", but "elif" is just not my cup of tea.
For this case goto provides symmetrical and explicit look, which I value a lot.


Mikhail



More information about the Python-list mailing list