GOTO w/ Python?

Gerhard Häring gerhard at bigfoot.de
Fri Jun 21 10:00:33 EDT 2002


In article <Xns923496C17397Frcamesz at amesz.demon.nl>, Robert Amesz wrote:
> The most goto-like contructs in Python are 'return' (which exits from a 
> function/method before the end is reached) and 'break' (which exits a 
> loop, continuing with statement followin that loop).

And 'continue', which immediately goes to the beginning of the loop.

Speaking of which, unlike in some other languages, 'break' and 'continue'
cannot be used with named loops, so you need exceptions in this case.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list