From d559513a682ae91a85d823b414df7588c04b1e5a Mon Sep 17 00:00:00 2001 From: warren Date: Tue, 7 Mar 2023 09:36:37 -0500 Subject: DOC: Document that info() handles array instances. [skip actions] [skip travis] [skip azp] [skip cirrus] --- numpy/lib/utils.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 8d2d2fe33..5d5770c71 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -533,10 +533,11 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): Parameters ---------- object : object or str, optional - Input object or name to get information about. If `object` is a - numpy object, its docstring is given. If it is a string, available - modules are searched for matching objects. If None, information - about `info` itself is returned. + Input object or name to get information about. If `object` is + an `ndarray` instance, information about the array is printed. + If `object` is a numpy object, its docstring is given. If it is + a string, available modules are searched for matching objects. + If None, information about `info` itself is returned. maxwidth : int, optional Printing width. output : file like object, optional @@ -575,6 +576,22 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): *** Repeat reference found in numpy.fft.fftpack *** *** Total of 3 references found. *** + When the argument is an array, information about the array is printed. + + >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) + >>> np.info(a) + class: ndarray + shape: (2, 3) + strides: (24, 8) + itemsize: 8 + aligned: True + contiguous: True + fortran: False + data pointer: 0x562b6e0d2860 + byteorder: little + byteswap: False + type: complex64 + """ global _namedict, _dictlist # Local import to speed up numpy's import time. -- cgit v1.2.1