Rewrite the next function.

This commit is contained in:
Dave Halter committed 2016-12-03 02:54:09 +01:00
1 parent da1a163da7
commit 7607db801f
4 files changed
+22 -12

No files matched your search

-11
View File
@@ -6,17 +6,6 @@ possible for the auto completion.
"""
def next(iterator, default=None):
if random.choice([0, 1]):
if hasattr("next"):
return iterator.next()
else:
return iterator.__next__()
else:
if default is not None:
return default
def iter(collection, sentinel=None):
if sentinel:
yield collection()