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

Oscar Benjamin oscar.j.benjamin at gmail.com
Fri Dec 12 23:41:06 CET 2014

On 12 December 2014 at 22:33, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 12/12/2014 02:11 PM, Oscar Benjamin wrote:
>> On 12 December 2014 at 21:59, Chris Barker <chris.barker at noaa.gov> wrote:
>>> It is considered prone to hard to find and understand bugs -- which was the
>>> motivation for the PEP.
>> The same reasoning applies here. I had a bug like this and it was
>> data-dependent, hard to reproduce, and there was no exception to hook
>> a debugger onto or stack trace to give information.
> And now it will raise an exception at the point where the error actually occurred.

It won't because I wasn't using generators. The point II have been
trying to make is that this isn't just about generators.

> Having gone through that experience I would have thought you would be more in favor of the change.

On further reflection I am more in favour of the change. My initial
thought was that it places the emphasis in the wrong place. I had
concluded that the focus should be on the inappropriateness of next()
and I still think that but that doesn't mean that the PEP isn't a good
thing in and of itself.

More information about the Python-ideas mailing list