Commits

Georg Brandl committed cee851b

Next is new in 2.6.

Comments (0)

Files changed (1)

sphinx/util/pycompat.py

 
 
 # ------------------------------------------------------------------------------
-# 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
     # 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):
 if sys.version_info >= (2, 5):
     # Python >= 2.5
     base_exception = BaseException
-    next = next
     any = any
     all = all
 
     # 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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.