[Python-ideas] Map and filter should also convert StopIteration to RuntimeError

Chris Barker chris.barker at noaa.gov
Fri Dec 12 22:59:15 CET 2014


On Fri, Dec 12, 2014 at 1:44 PM, Oscar Benjamin <oscar.j.benjamin at gmail.com>
wrote:
>
> I guess the question is: should it be considered a bug for an iterator
> to leak a StopIteration outside of its "normal" exit condition?
> Apparently it was for generators


I  don't think anyone aid it was a bug -- often it is a bug, but that's
use-case dependent.

which represent the majority of all
> iterators and it was considered sufficiently important to change the
> core language in a backward incompatible way.


It is considered prone to hard to find and understand bugs -- which was the
motivation for the PEP.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141212/6ddb8b23/attachment.html>


More information about the Python-ideas mailing list