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.

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?

If the latter, then 'return' and 'return None' would
no longer be equivalent in all cases, which would be
rather strange.

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.

--
Greg
_______________________________________________
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

Reply via email to