[email protected] wrote:
>
> from help:
> """
> Returns:
> reshaped_array : ndarray
> This will be a new view object if possible; otherwise, it will be a copy.
> """
>
> " if possible" and "otherwise" are not very precise
> I guess reshape tries to return an array that is contiguous, if you do
> a reshape in the order of the array, i.e.
>
> change your line to
> b = a.reshape((6,), order=order)
>
> then the reshaped array is just a view.
>
> I still find view vs copy very confusing.
>   
You are right, the documentation doesn't lies.

The simplistic current version choice is a copy.
In my example, b is 1D, contiguous, with no 'C' or 'F' difference.
Then that's possible to do an other choice, making a view.

The reshape function is unpredictable and its behaviour is not documented.

It cannot be used safely.

Another remark against reshape:
OWNDATA flag is False, even if b is a copy !

-- 
FP





_______________________________________________
Numpy-discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to