diff options
author | mattip <matti.picus@gmail.com> | 2018-04-22 01:42:29 +0300 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2018-04-23 22:31:42 +0300 |
commit | 86608c2883b9f1db468bf6d3b6d2a82a72f48b0f (patch) | |
tree | 6ab6c0fa10e4224bc024dcb2f44e753362c47460 /numpy/add_newdocs.py | |
parent | f2888dbfc440cc3023b751fb7a5d91b9817fc271 (diff) | |
download | numpy-86608c2883b9f1db468bf6d3b6d2a82a72f48b0f.tar.gz |
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 93a521658..eb76dc045 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` + """)) |