[Numpy-discussion] Ransom Proposals

Travis Oliphant oliphant.travis at ieee.org
Mon Mar 27 23:20:04 CST 2006


Charles R Harris wrote:
> Tim,
>
>
>     That being said I have a suggestion that *might* satisfy everyone. Set
>     the WRITEABLE flag to false if reshape creates a new array: 
>
>
> I think this will cause problems as I myself usually want to modify 
> the contents after a reshape. Why not in this case have a.reshape(...) 
> return a view when possible and raise an error otherwise, and have the 
> functional form make a copy. Reshape the method then provides a path 
> to efficient computing, while reshape the function promotes safe 
> computing. I like to write classes in C++ where I can do things like
> b.mul(c).add(d).div(e) all inplace for efficiency and the current 
> situation strikes me as similar.
>
This is the direction I could support.   If we did this, then the ravel 
method would also have to change to be consistent.

The functions would be copy-if-necessary and would *not* be deprecated.

To summarize

on making methods that return views raise an error when impossible and 
not changing and/or deprecating functions (i.e. the functions are simple 
wrappers around the methods).

-1

on making methods that return views raise an error when impossible and 
changing the function to make a copy

+0



-Travis





More information about the Numpy-discussion mailing list