GOTO w/ Python?
Max M
maxm at mxm.dk
Thu Jun 20 05:36:29 EDT 2002
Michael Hudson wrote:
> "John Roth" <johnroth at ameritech.net> writes:
>
>
>>There's no equivalent of a goto command in Python, for good reason,
>>which I won't repeat here. Prof. Djikstra did it very well in 1974,
>>in his letter "Goto Considered Harmful."
>
>
> There are also technical difficulties implementing it (the
> blockstack), or I'd have probably done goto functionality in
> bytecodehacks :)
What do you mean???
Goto's are simple ;-)
def goto(lable):
lable()
def start():
print 'starting'
goto(lable2)
def lable1():
print 'at lable 1'
goto(stop)
def lable2():
print 'at lable 2'
goto(lable1)
def stop():
print 'stopping'
goto(start)
>>> starting
>>> at lable 2
>>> at lable 1
>>> stopping
More information about the Python-list
mailing list