"Goto" statement in Python

Thomas Nyberg tomuxiong at gmx.com
Thu Apr 13 13:31:18 EDT 2017


On 04/12/2017 04:42 PM, Mikhail V wrote:
> For me it looks clear and I'd say easy to comprehend,
> Main critic would be obviously that it is not
> a good, *scalable application*, but quite often I don't
> even have this in mind, and just want to express a
> step-by-step direct instructions.

I think that scalability is the only objectively reasonable (at least as
far as this kind of argument could be objective) argument against gotos.
They're not fundamentally a bad idea (the people who put them into
certain languages weren't stupid after all), but they do seem to create
a maintenance and complexity burden as the codebase grows. But if you're
talking one off single scripts as your example, I think you can safely
use many habits considered bad by most. That's simply not the scenario
where gotos create a problem.

There are of course many different ways you can get around using them,
but there are certainly cases where that's exactly what you want and a
substitute will always be a substitute and it may feel lacking. It's
just a matter of taste really.

Cheers,
Thomas


More information about the Python-list mailing list