summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorJarrod Millman <millman@berkeley.edu>2010-02-17 23:42:42 +0000
committerJarrod Millman <millman@berkeley.edu>2010-02-17 23:42:42 +0000
commitdcc721a5bddde3afd4ce47d7a7b76ec6c7102b92 (patch)
treedfb944339fc1bb15294efc2c903500ac66450c8c /numpy/core/numeric.py
parentd9e1ff3f202f2c80d0a7816935c73fec57734aff (diff)
downloadnumpy-dcc721a5bddde3afd4ce47d7a7b76ec6c7102b92.tar.gz
updated docstrings from pydoc website (thanks to everyone who contributed!)
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py27
1 files changed, 8 insertions, 19 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 176212d09..fba6512b2 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -262,6 +262,14 @@ def asarray(a, dtype=None, order=None):
>>> np.asarray(a) is a
True
+ If `dtype` is set, array is copied only if dtype does not match:
+
+ >>> a = np.array([1, 2], dtype=np.float32)
+ >>> np.asarray(a, dtype=np.float32) is a
+ True
+ >>> np.asarray(a, dtype=np.float64) is a
+ False
+
Contrary to `asanyarray`, ndarray subclasses are not passed through:
>>> issubclass(np.matrix, np.ndarray)
@@ -2090,25 +2098,6 @@ def seterr(all=None, divide=None, over=None, under=None, invalid=None):
Warning: overflow encountered in short_scalars
30464
- Calling `seterr` with no arguments resets treatment for all floating-point
- errors to the defaults. XXX: lies!!! code doesn't do that
- >>> np.geterr()
- {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'}
- >>> np.seterr(all='warn')
- {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'}
- >>> np.geterr()
- {'over': 'warn', 'divide': 'warn', 'invalid': 'warn', 'under': 'warn'}
- >>> np.seterr() # XXX: this should reset to defaults according to docstring above
- {'over': 'warn', 'divide': 'warn', 'invalid': 'warn', 'under': 'warn'}
- >>> np.geterr() # XXX: but clearly it doesn't
- {'over': 'warn', 'divide': 'warn', 'invalid': 'warn', 'under': 'warn'}
-
- >>> old_settings = np.seterr()
- >>> old_settings = np.seterr(all='ignore')
- >>> np.geterr()
- {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore',
- 'under': 'ignore'}
-
"""
pyvals = umath.geterrobj()