Goto

bartc bc at freeuk.com
Fri Dec 29 15:03:37 EST 2017


On 29/12/2017 18:55, MarkA wrote:
> On Thu, 28 Dec 2017 00:58:48 -0200, Duram wrote:
> 
>> How to use goto in python?
>>
>> ---
>> This email has been checked for viruses by AVG.
>> http://www.avg.com
> 
> Rather than ask how to use an unavailable statement (GOTO), why not
> investigate why no modern languages use it?

Golang uses goto.

Lua didn't have goto but then added it.

PHP also added goto to a later version.

That's the extent of my one minutes' research; I guess a few other 
newish languages might use it (plus any I create myself, and pile of 
older languages).

Why most newer, higher level languages don't, I don't know. Perhaps 
because the people who design them want to make programming harder? Or 
they are adept at doing without it, and expect everyone else to be 
equally so?

Nothing wrong with goto when you have a throwaway program to finish and 
an approaching deadline.

Overuse of goto in real applications would be a problem, but that's the 
same with any feature. In Python, you can define F as function, but then 
reassign any other arbitrary value to F, at any point in a program, at 
any time, and as many times as you like. That makes goto seem almost 
benign! (Except that Python would probably let you assign to labels...)

-- 
bartc




More information about the Python-list mailing list