diff options
author | Thomas Green <tomgreen66@hotmail.com> | 2021-12-08 11:57:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 11:57:10 +0000 |
commit | dc766fc1abb546ab883f76ef4e405e99e9287ab6 (patch) | |
tree | 9e7c7748ba8bfbb2ba5224633b0725909712d2fa /numpy/lib/utils.py | |
parent | 1cfdac82ac793061d8ca4b07c046fc6b21ee7e54 (diff) | |
parent | ab7a1927353ab9dd52e3f2f7a1a889ae790667b9 (diff) | |
download | numpy-dc766fc1abb546ab883f76ef4e405e99e9287ab6.tar.gz |
Merge branch 'numpy:main' into armcompiler
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 1df2ab09b..c74ee127d 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -429,7 +429,7 @@ def _makenamedict(module='numpy'): return thedict, dictlist -def _info(obj, output=sys.stdout): +def _info(obj, output=None): """Provide information about ndarray obj. Parameters @@ -455,6 +455,9 @@ def _info(obj, output=sys.stdout): strides = obj.strides endian = obj.dtype.byteorder + if output is None: + output = sys.stdout + print("class: ", nm, file=output) print("shape: ", obj.shape, file=output) print("strides: ", strides, file=output) @@ -481,7 +484,7 @@ def _info(obj, output=sys.stdout): @set_module('numpy') -def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): +def info(object=None, maxwidth=76, output=None, toplevel='numpy'): """ Get help information for a function, class, or module. @@ -496,7 +499,8 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): Printing width. output : file like object, optional File like object that the output is written to, default is - ``stdout``. The object has to be opened in 'w' or 'a' mode. + ``None``, in which case ``sys.stdout`` will be used. + The object has to be opened in 'w' or 'a' mode. toplevel : str, optional Start search at this level. @@ -541,6 +545,9 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): elif hasattr(object, '_ppimport_attr'): object = object._ppimport_attr + if output is None: + output = sys.stdout + if object is None: info(info) elif isinstance(object, ndarray): |