Skip to content

Commit

Permalink
Merge pull request numpy#23355 from WarrenWeckesser/doc-info
Browse files Browse the repository at this point in the history
DOC: Document that info() handles array instances.
  • Loading branch information
seberg authored Mar 7, 2023
2 parents e82af22 + 3b57b32 commit b6d372c
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions numpy/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,16 @@ def _info(obj, output=None):
@set_module('numpy')
def info(object=None, maxwidth=76, output=None, toplevel='numpy'):
"""
Get help information for a function, class, or module.
Get help information for an array, function, class, or module.
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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit b6d372c

Please sign in to comment.