[Tutor] Using goto or labels in Python?

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Feb 11 19:54:32 CET 2015


On 11/02/2015 18:14, Alan Gauld wrote:
> On 11/02/15 10:44, Raphael Raphael wrote:
>> Hello,
>
> Hello, please do not post the entire digest to ask a new question.
> Some people pay by the byte.
> Just send a new mail to tutor at python.org.
>
>
>> Is there a way in which people have found to use goto or labels in
>> Python?thank you.
>
> No. Python does not have a goto because using goto is
> considered bad programming practice and is never necessary
> (although *very* occasionally it can be simpler and clearer
> to use goto IMHO).

http://entrian.com/goto/ but note the warning in bright red right at the top
https://github.com/cdjc/goto never tried this one

The one time that I'd consider goto is jumping to an error handler.

>
> What are you trying to do that you think needs a goto and we
> can see if there is a clearer way to write it without goto.
>

Definitely :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list