"Goto" statement in Python
rustompmody at gmail.com
Thu Apr 13 23:20:44 EDT 2017
On Friday, April 14, 2017 at 7:15:11 AM UTC+5:30, Steve D'Aprano wrote:
> On Fri, 14 Apr 2017 12:52 am, bartc wrote:
> > I know this isn't the Python need-for-speed thread, but this is a
> > classic example where the lack of one simple feature leads to using
> > slower, more cumbersome ones.
> Dear gods, have I fallen back in time to 1975 again?
Good that you start with the suggestion that we are not in 1975
> Features should not be judged solely on their usefulness to the best 1% of
> programmers using the feature in the best possible way. You also need to
> consider the lesser mortals, the below-average 50% of programmers who will
> use the feature in sub-optimal if not outright terrible ways.
> GOTOs are far to easy to abuse. The harm that they do is outweighed a
> thousand times by the rare positive use. Most languages do well to avoid
> GOTO, even if that means that there are one or two rare uses that have to
> be written slightly sub-optimally for the lack.
That sounds very 1970s to me.
With the languages that I (and presumably you) grew up with using gotos was
too easy; not using was hard or impossible.
The most structured was Pascal which set out to be ornery by making one declare
labels. With everything else — Fortran-IV, Basic, assembler — it was next to
Where/how would he have learnt to use gotos?
In short: In 1968 "Goto statement considered harmful" was a necessary viewpoint.
Today its a quasi-religious bias without basis.
Personal Note: Much of the direction that my programming/teaching has taken in
the last 30 years can be traced to a statement made by a teacher when I was graduating:
“What the goto does to control-structure, the assignment does to data-structure”
More information about the Python-list