Use next() function instead of iter.next().

This commit is contained in:
Georg Brandl 2010-07-28 18:51:57 +02:00
parent 87bbe8ddd5
commit 434da2a4fb
2 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,7 @@ from sphinx.errors import PycodeError
from sphinx.pycode import nodes
from sphinx.pycode.pgen2 import driver, token, tokenize, parse, literals
from sphinx.util import get_module_source
from sphinx.util.pycompat import next
from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc
@ -279,7 +280,7 @@ class ModuleAnalyzer(object):
result[fullname] = (dtype, startline, endline)
expect_indent = False
if tok in ('def', 'class'):
name = tokeniter.next()[1]
name = next(tokeniter)[1]
namespace.append(name)
fullname = '.'.join(namespace)
stack.append((tok, fullname, spos[0], indent))

View File

@ -34,6 +34,14 @@ else:
b = str
try:
next
except NameError:
# this is on Python 2, where the method is called "next"
def next(iterator):
return iterator.next()
try:
any = any
all = all