summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-07-07 08:17:24 -0700
committerGitHub <noreply@github.com>2019-07-07 08:17:24 -0700
commit50d76e86eaad117167da1453c18c2ab786217cf4 (patch)
tree13d49a92635cc9ccde0c0879f1b9d44ebfa374ea
parent95c243221da5bedb7230e9ff229748f50acaf869 (diff)
parent68b8b2757c494c5f3957eb5ba5561ea04bfceeae (diff)
downloadnumpy-50d76e86eaad117167da1453c18c2ab786217cf4.tar.gz
Merge pull request #13926 from MSeifert04/replace-next-method-calls
DOC: Remove explicit .next method calls with built-in next function calls
-rw-r--r--doc/source/reference/arrays.classes.rst2
-rw-r--r--numpy/core/_add_newdocs.py6
-rw-r--r--numpy/linalg/lapack_lite/fortran.py2
-rw-r--r--numpy/ma/core.py10
4 files changed, 9 insertions, 11 deletions
diff --git a/doc/source/reference/arrays.classes.rst b/doc/source/reference/arrays.classes.rst
index 4f97b4ece..3b13530c7 100644
--- a/doc/source/reference/arrays.classes.rst
+++ b/doc/source/reference/arrays.classes.rst
@@ -448,7 +448,7 @@ object, then the Python code::
some code involving val
...
-calls ``val = myiter.next()`` repeatedly until :exc:`StopIteration` is
+calls ``val = next(myiter)`` repeatedly until :exc:`StopIteration` is
raised by the iterator. There are several ways to iterate over an
array that may be useful: default iteration, flat iteration, and
:math:`N`-dimensional enumeration.
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py
index 02700c8ca..accf19db4 100644
--- a/numpy/core/_add_newdocs.py
+++ b/numpy/core/_add_newdocs.py
@@ -94,7 +94,7 @@ add_newdoc('numpy.core', 'flatiter', ('coords',
>>> fl = x.flat
>>> fl.coords
(0, 0)
- >>> fl.next()
+ >>> next(fl)
0
>>> fl.coords
(0, 1)
@@ -113,7 +113,7 @@ add_newdoc('numpy.core', 'flatiter', ('index',
>>> fl = x.flat
>>> fl.index
0
- >>> fl.next()
+ >>> next(fl)
0
>>> fl.index
1
@@ -666,7 +666,7 @@ add_newdoc('numpy.core', 'broadcast', ('iters',
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> row, col = b.iters
- >>> row.next(), col.next()
+ >>> next(row), next(col)
(1, 4)
"""))
diff --git a/numpy/linalg/lapack_lite/fortran.py b/numpy/linalg/lapack_lite/fortran.py
index 87c27aab9..dc0a5ebd9 100644
--- a/numpy/linalg/lapack_lite/fortran.py
+++ b/numpy/linalg/lapack_lite/fortran.py
@@ -54,7 +54,7 @@ class PushbackIterator(object):
Return an iterator for which items can be pushed back into.
Call the .pushback(item) method to have item returned as the next
- value of .next().
+ value of next().
"""
def __init__(self, iterable):
object.__init__(self)
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 0403a85d4..a4f664a04 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2681,15 +2681,13 @@ class MaskedIterator(object):
--------
>>> x = np.ma.array([3, 2], mask=[0, 1])
>>> fl = x.flat
- >>> fl.next()
+ >>> next(fl)
3
- >>> fl.next()
+ >>> next(fl)
masked
- >>> fl.next()
+ >>> next(fl)
Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "/home/ralf/python/numpy/numpy/ma/core.py", line 2243, in next
- d = self.dataiter.next()
+ ...
StopIteration
"""