5 Nov
2014
5 Nov
'14
1:18 a.m.
On 5/11/2014 1:55 p.m., Terry Reedy wrote:
There is already a 'default' option, so the two would have to be mutually exclusive.
"next(iterator[, default])
If it were a keyword-only argument, there wouldn't be any conflict. But I'm not sure I like the idea of adding more complexities to the iterator protocol. Anything that changes the signature of __next__ or __iter__ would be a bad idea, since all existing iterables would need to be updated to take it into account. If this is is to be done, it might be better to add a new optional dunder method, so that existing iterables would continue to work. -- Greg