From 32f382c86f384a02eeb87f67fea806e6b9961b5c Mon Sep 17 00:00:00 2001 From: John Han Date: Thu, 12 Mar 2020 09:52:15 -0700 Subject: DOC: Do not complain about contiguity when mutating `ndarray.shape` (gh-10600) There are multiple conditions that `_attempt_nocopy_reshape` checks for when ndarray.shape is mutated directly. Discussion of #10146 indicated that an error message referencing any type of contiguity would not be correct for all cases, so the error message has been changed to be more general. * ENH: shorten message and use "in-place" * MAINT: typo from review Co-authored-by: hanjohn Co-authored-by: mattip --- numpy/core/fromnumeric.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index acd2d2bea..b32ad8d35 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -252,7 +252,8 @@ def reshape(a, newshape, order='C'): >>> c.shape = (20) Traceback (most recent call last): ... - AttributeError: incompatible shape for a non-contiguous array + AttributeError: Incompatible shape for in-place modification. Use + `.reshape()` to make a copy with the desired shape. The `order` keyword gives the index ordering both for *fetching* the values from `a`, and then *placing* the values into the output array. -- cgit v1.2.1