On Fri, Mar 16, 2001 at 03:37:33AM -0800, Neil Schemenauer wrote: > ... it looks like it would be similer to put this code in the > switch statement. Um, no. Bad idea. Even if I could restructure the loop, try/finally blocks mess everything up anyhow. After searching through many megabytes of python-dev archives (grepmail is my friend), I finally found the posts Tim was referring me to (Subject: Generator details, Date: July 1999). Guido and Tim already had the answer for me. Now: import sys def g(): for n in range(10): suspend n, sys._getframe() return None, None n, frame = g() while frame: print n n, frame = frame.resume() merrily prints 0 to 9 on stdout. Whee! Neil
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4