"Goto" statement in Python

Rob Gaddi rgaddi at highlandtechnology.invalid
Fri Apr 14 13:07:41 EDT 2017


On 04/14/2017 07:19 AM, Dennis Lee Bieber wrote:
> On Fri, 14 Apr 2017 11:44:59 +1000, Steve D'Aprano
> <steve+python at pearwood.info> declaimed the following:
>
>>
>> Even that's not enough for some. Donald Knuth, who supports the use of GOTO
>> under some circumstances, maintains that any program using GOTOs should
>> have the invariant that its flow chart can be drawn with all forward
>> branches on the left, all backward branches on the right, and no branches
>> crossing each other.
>>
>
> 	Good thing I never had him for an instructor... My practice, when last
> flow-charting, favored back-branches on the left.
>
> 	After all, I read left-to-right/top-to-bottom, so forward branches
> going right and down seem natural. Encountering a branch going left sort of
> implies "re-reading" part of the chart; going upwards...
>

Yeah, but I love the naked concept there.  It pretty much encapsulates 
what I find to be the only useful use of GOTO in any reasonable language 
in a simple, easy to visualize way.  If your GOTOs are crossing you've 
done something wrong.

If more people had good mechanisms for visualizing their code I'd use 
far less profanity literally every day of my life.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list