diff options
author | Allan Haldane <ealloc@gmail.com> | 2018-04-27 13:04:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 13:04:10 -0400 |
commit | 0a02ea2403f1d666ad186d8228cbe7d499b037c7 (patch) | |
tree | 34bdb2668257105e9c6e5ff6f11dd8644cf62f90 /numpy/add_newdocs.py | |
parent | 79cd01d4e7daaf925d29194ce0cdfa7b14dba85c (diff) | |
parent | 246ad1dd3006ed4230a5c457838450f96df755e7 (diff) | |
download | numpy-0a02ea2403f1d666ad186d8228cbe7d499b037c7.tar.gz |
Merge pull request #10949 from mattip/doc-nditer
DOC: cleanup documentation, continuation of nditer PR #9998
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index c187f8e31..947004001 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -385,10 +385,11 @@ add_newdoc('numpy.core', 'nditer', array([ 0.5, 1.5, 4.5, 9.5, 16.5]) If operand flags `"writeonly"` or `"readwrite"` are used the operands may - be views into the original data with the WRITEBACKIFCOPY flag. In this case - nditer must be used as a context manager. The temporary - data will be written back to the original data when the `` __exit__`` - function is called but not before:: + be views into the original data with the `WRITEBACKIFCOPY` flag. In this case + nditer must be used as a context manager or the nditer.close + method must be called before using the result. The temporary + data will be written back to the original data when the `__exit__` + function is called but not before: >>> a = np.arange(6, dtype='i4')[::-2] >>> with nditer(a, [], @@ -405,7 +406,7 @@ add_newdoc('numpy.core', 'nditer', references (like `x` in the example) may or may not share data with the original data `a`. If writeback semantics were active, i.e. if `x.base.flags.writebackifcopy` is `True`, then exiting the iterator - will sever the connection between `x` and `a`, writing to `x` will + will sever the connection between `x` and `a`, writing to `x` will no longer write to `a`. If writeback semantics are not active, then `x.data` will still point at some part of `a.data`, and writing to one will affect the other. @@ -566,6 +567,11 @@ add_newdoc('numpy.core', 'nditer', ('close', Resolve all writeback semantics in writeable operands. + See Also + -------- + + :ref:`nditer-context-manager` + """)) |