Josiah Carlson kindly pointed out (off list), that my use of SuspendIteration violates the standard idiom of exceptions terminating the current function. This got past me, beacuse I think a generator not as a function, but rather as a shortcut to creating iterators. The offending code is, | def NonBlockingResource(): | yield "one" | while True: | rand = randint(1,10) | if 2 == rand: | break | raise SuspendIteration() | yield "two" There are two solutions: (a) introduce a new keyword 'suspend'; or, (b) don't do that. It is not essential to the proposal that the generator syntax produce iterators that can SuspendIteration, it is only essential that the implementation of generators pass-through this exception. Most non-blocking resources will be low-level components from an async database or socket library; they can make iterators the old way. Cheers, Clark
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