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:
Bo Wang 2016-01-19 00:33:14 +08:00
parent 7b7dfdf7fb
commit af8a9f10b2
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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