Replaced foo.next() by next(foo).

This new syntax for next() has been introduced in Python 2.6 and is
compatible with Python 3.
This commit is contained in:
Claude Paroz 2012-05-10 20:14:04 +02:00
parent 1c1a229632
commit 169b1a404c
20 changed files with 73 additions and 73 deletions

View file

@ -128,7 +128,7 @@ class QuerySet(object):
if self._result_cache is not None:
return bool(self._result_cache)
try:
iter(self).next()
next(iter(self))
except StopIteration:
return False
return True
@ -877,7 +877,7 @@ class QuerySet(object):
if self._iter:
try:
for i in range(num or ITER_CHUNK_SIZE):
self._result_cache.append(self._iter.next())
self._result_cache.append(next(self._iter))
except StopIteration:
self._iter = None
@ -1147,7 +1147,7 @@ class EmptyQuerySet(QuerySet):
def iterator(self):
# This slightly odd construction is because we need an empty generator
# (it raises StopIteration immediately).
yield iter([]).next()
yield next(iter([]))
def all(self):
"""