Merge "Python3:Replace iter.next() with next(iter)"
This commit is contained in:
@@ -38,7 +38,7 @@ class GlanceClient(object):
|
|||||||
images = self.client.images.list()
|
images = self.client.images.list()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
image = images.next()
|
image = next(images)
|
||||||
yield GlanceClient._format(image)
|
yield GlanceClient._format(image)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
break
|
break
|
||||||
|
@@ -179,7 +179,7 @@ def random_name():
|
|||||||
@specs.extension_method
|
@specs.extension_method
|
||||||
def first_or_default(collection, default=None):
|
def first_or_default(collection, default=None):
|
||||||
try:
|
try:
|
||||||
return iter(collection).next()
|
return next(iter(collection))
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user