Http://entrian.com/goto/
LookSource codeThe trace is modified for all functions, and then the set function is executed when an exception occurs.
# Install the trace function, including all preceding frames.
SYS. settrace (_ trace)
Frame = SYS. _ getframe (). f_back
While frame:
Frame. f_trace = _ trace
Frame = frame. f_back
Change the day to see how to analyze each row in the traceCodeOf!
# Example 1: Breaking out from a deeply nested loop:
From goto import Goto, label
For I in range (1, 10 ):
For J in range (1, 20 ):
For k in range (1, 30 ):
Print I, J, K
If K = 3:
Goto. End
Label. End
Print "finished \ n"
# Example 2: restarting a loop:
From goto import Goto, label
Label. Start
For I in range (1, 4 ):
Print I
If I = 2:
Try:
Output = message
Failed t nameerror:
Print "oops-Forgot to define 'message '! Start again ."
Message = "Hello World"
Goto. Start
Print Output, "\ n"