diff options
author | Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> | 2021-11-18 00:07:55 +0100 |
---|---|---|
committer | Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> | 2021-11-18 22:40:47 +0100 |
commit | 60999d5af0fa142cabe67381e0033b203de3f083 (patch) | |
tree | 15aa1cda22a533fe5df86f78e3bd5f3affe65806 /numpy/core/fromnumeric.py | |
parent | 5d70de730b7b3f1586826f708a9c0cda37d95511 (diff) | |
download | numpy-60999d5af0fa142cabe67381e0033b203de3f083.tar.gz |
Make numpy.shape examples less ambiguous
- The shape shound not coincidetially contain the same numbers as the data
- For structured arrays, the shape should not coincide with the number of fields
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 3e2d49c8b..a65a019c0 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1987,18 +1987,19 @@ def shape(a): -------- >>> np.shape(np.eye(3)) (3, 3) - >>> np.shape([[1, 2]]) + >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) () - >>> a = np.array([(1, 2), (3, 4)], dtype=[('x', 'i4'), ('y', 'i4')]) + >>> a = np.array([(1, 2), (3, 4), (5, 6)], + dtype=[('x', 'i4'), ('y', 'i4')]) >>> np.shape(a) - (2,) + (3,) >>> a.shape - (2,) + (3,) """ try: |