"Clark C. Evans" <cce at clarkevans.com>: > In fact, one could implement it using a SuspendIteration exception, > in addition to a StopIteration. I don't think this can be done quite right by raising an exception in the normal way, because you don't want 'finally' clauses to be triggered. > You'd definately want to mix them. For example, a 'cooperator' > would be reading from a socket, it could do one of three things: > > yield the next line from the sender > raise StopIteration if the socket closed > raise SuspendIteration if the read() is blocked Hmmm. It seems that generation and cooperation are really orthogonal concepts -- you may want something that is both a generator *and* a cooperator. My proposal doesn't allow for this. I will have to do some more thinking... Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+
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