Python3:Replace iter.next() with next(iter)
function next() of iterator is not available in python3. ref:http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html Targets blueprint: murano-python-3-support Change-Id: I8cb74520187ba532ad98b86b6ac15737a6cc9bee
This commit is contained in:
parent
7b7dfdf7fb
commit
af8a9f10b2
|
@ -38,7 +38,7 @@ class GlanceClient(object):
|
|||
images = self.client.images.list()
|
||||
while True:
|
||||
try:
|
||||
image = images.next()
|
||||
image = next(images)
|
||||
yield GlanceClient._format(image)
|
||||
except StopIteration:
|
||||
break
|
||||
|
|
|
@ -179,7 +179,7 @@ def random_name():
|
|||
@specs.extension_method
|
||||
def first_or_default(collection, default=None):
|
||||
try:
|
||||
return iter(collection).next()
|
||||
return next(iter(collection))
|
||||
except StopIteration:
|
||||
return default
|
||||
|
||||
|
|
Loading…
Reference in New Issue