Guido van Rossum wrote:
but for backwards compatibility with the existing argument-less next() API I'm introducing a new iterator API next_ex() which takes an exception argument. If that argument is None, it should behave just like next(). Otherwise, if the iterator is a generator, this will
Might this be a good time to introduce __next__ (having the same signature and semantics as your proposed next_ex) and builtin next(obj, exception=None)?
def next(obj, exception=None):
if hasattr(obj, '__next__'):
return obj.__next__(exception) if exception is not None:
return obj.next(exception) # Will raise an appropriate exceptionreturn obj.next()
Tim Delaney
_______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
