On Sat, Mar 28, 2009 at 1:36 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: > Guido van Rossum wrote: > >> The new exception could either be a designated (built-in) subclass of >> StopIteration, or not; > > I think it would have to not be; otherwise any existing > code that catches StopIteration would catch the new > exception as well without complaint. OK. > Using a different exception raises another question. > Would you check whether the return value is None and > raise an ordinary StopIteration in that case? Or would > return with a value always raise the new exception? I'm not sure it matters much, but let's sat the latter. > If the latter, then 'return' and 'return None' would > no longer be equivalent in all cases, which would be > rather strange. They already aren't in generators, 'return' is allowed but 'return None' isn't. >> I think in either case a check in >> PyIter_Next() would cover most cases > > If that's acceptable, then the check might as well > be for None as the StopIteration value, and there's > no need for a new exception. I don't understand this. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
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