Goto

bartc bc at freeuk.com
Fri Dec 29 17:56:21 EST 2017


On 29/12/2017 21:56, Stefan Ram wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> On Sat, Dec 30, 2017 at 8:03 AM, D'Arcy Cain <darcy at vybenetworks.com> wrote:
>>> On 12/29/2017 02:25 PM, Chris Angelico wrote:
>>>>> PHP also added goto to a later version.
>>>> Ahh, great choice of example. "It's okay - PHP does it."
>>> I thought that that was a reason to not do it.
>> Often, yeah. Hence my comment that "hey, PHP has goto" is an excellent
>> choice of example.
> 
>    I already wrote this before, recently, in some newsgroup (here?):
> 
>    Knuth's algorithm's often use "goto"'s. When translating them into
>    another language, it is helpful to be able to translate them as
>    direct as possible. Having to change the algorithm in one's head
>    to avoid "goto" while converting it to Python seems to be a
>    source of errors.
> 
>    When a language has a "goto", one can then translate Knuth's
>    algorithms more literally. One then can add tests. And /then/
>    one can refactor step-by-step to an algorithm without "goto".
> 


That sort of argument will never wash here:

"/I/ can write code without ever using 'goto'. So nobody else should 
ever need to use it either".

Forget about automatic code translators, automatic parser generators, 
automatic state machine translators, plus a host of other uses which 
goto could simplify.




More information about the Python-list mailing list