mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
*args / **kwargs remodelled
This commit is contained in:
@@ -3,5 +3,14 @@
|
||||
try:
|
||||
next = next
|
||||
except NameError:
|
||||
def next(obj):
|
||||
return obj.next()
|
||||
_raiseStopIteration = object()
|
||||
def next(iterator, default=_raiseStopIteration):
|
||||
if not hasattr(iterator, 'next'):
|
||||
raise TypeError("not an iterator")
|
||||
try:
|
||||
return iterator.next()
|
||||
except StopIteration:
|
||||
if default is _raiseStopIteration:
|
||||
raise
|
||||
else:
|
||||
return default
|
||||
|
||||
Reference in New Issue
Block a user