summaryrefslogtreecommitdiff
path: root/sphinx/util
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-21 22:19:50 +0200
committerGeorg Brandl <georg@python.org>2010-08-21 22:19:50 +0200
commit14e4af35417585392628ceddcbb5402278b4a2ca (patch)
treef69ebf09015fa2f89764e5cb4d36620b96719e8a /sphinx/util
parent5a02e9343f9456f0b7b16c81aa28405e227ab54b (diff)
downloadsphinx-14e4af35417585392628ceddcbb5402278b4a2ca.tar.gz
Next is new in 2.6.
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/pycompat.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index e5a712c9..319312a7 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -50,10 +50,12 @@ else:
# ------------------------------------------------------------------------------
-# Missing itertools in Python < 2.6
+# Missing builtins and itertools in Python < 2.6
if sys.version_info >= (2, 6):
# Python >= 2.6
+ next = next
+
from itertools import product
try:
from itertools import zip_longest # Python 3 name
@@ -64,6 +66,11 @@ else:
# Python < 2.6
from itertools import izip, repeat, chain
+ # this is on Python 2, where the method is called "next" (it is refactored
+ # to __next__ by 2to3, but in that case never executed)
+ def next(iterator):
+ return iterator.next()
+
# These replacement functions have been taken from the Python 2.6
# itertools documentation.
def product(*args, **kwargs):
@@ -94,7 +101,6 @@ else:
if sys.version_info >= (2, 5):
# Python >= 2.5
base_exception = BaseException
- next = next
any = any
all = all
@@ -102,11 +108,6 @@ else:
# Python 2.4
base_exception = Exception
- # this is on Python 2, where the method is called "next" (it is refactored
- # to __next__ by 2to3, but in that case never executed)
- def next(iterator):
- return iterator.next()
-
def all(gen):
for i in gen:
if not i: