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 exception return obj.next() Tim Delaney
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4