mirror of
https://github.com/django/django.git
synced 2025-09-23 10:42:45 +00:00
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:
parent
1c1a229632
commit
169b1a404c
20 changed files with 73 additions and 73 deletions
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue