On Sat, Mar 28, 2009 at 1:36 AM, Greg Ewing <greg.ew...@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/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com