Is "raise StopIteration" an abuse of exceptions? Why can we not use "return StopIteration" to signal the end of an iterator? I've done a bit of hacking and the idea seems to work. On possible problem is that the StopIteration object in the builtin module could cause some confusing behavior. For example the code: for obj in __builtin__.__dict__.values(): print obj would not work as expected. This could be fixed in most causes by changing the tp_iternext protocol. Something like: int tp_iternext(PyObject *it, PyObject **item) were the return value is 1, 0, or -1. IOW, StopIteration would not have to come into the protocol if the object implemented tp_iternext. 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