[Python-ideas] sentinel_exception argument to `iter`

Serhiy Storchaka storchaka at gmail.com
Mon Feb 10 19:34:01 CET 2014


08.02.14 10:32, Terry Reedy написав(ла):
> On 2/7/2014 9:28 AM, Serhiy Storchaka wrote:
>> 07.02.14 10:36, Terry Reedy написав(ла):
>>> I wrote the above with the idea that there would be a third parameter to
>>> provide an exception. It would have to have a private default like
>>>
>>> class _NoException(Exception): pass
>>
>> Natural default is StopIteration or ().
>
> That does not work because iter has to know if the user called iter with
> only one argument, an iterable, or with two or (with the proposal)
> three, with the first argument being a callable.

Agree.




More information about the Python-ideas mailing list