summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorwarren <warren.weckesser@gmail.com>2021-12-03 22:37:07 -0500
committerwarren <warren.weckesser@gmail.com>2021-12-03 22:37:07 -0500
commitc975a3724831739c2a536510d3998a7f3033d149 (patch)
tree5304f69120dc53b52ea512fbeca22fd551c6dd90 /numpy/lib/utils.py
parent6223584a5ec1e33b98619931e14460d54369dc0d (diff)
parenta81535a364ca2d5aa277977e53c4e2302cae8ea2 (diff)
downloadnumpy-c975a3724831739c2a536510d3998a7f3033d149.tar.gz
Merge branch 'main' into doc-fix-mvn-example
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py13
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):