[Numpy-discussion] Should arr.diagonal() return a copy or a view? (1.7 compatibility issue)

Travis Oliphant travis at continuum.io
Fri May 11 15:47:37 EDT 2012

On May 11, 2012, at 2:18 PM, Pauli Virtanen wrote:

> 11.05.2012 17:54, Frédéric Bastien kirjoitti:
>> In Theano we use a view, but that is not relevant as it is the
>> compiler that tell what is inplace. So this is invisible to the user.
>> What about a parameter to diagonal() that default to return a view not
>> writable as you said. The user can then choose what it want and this
>> don't break the inferface.
> [clip]
> Agreed, it seems this is the appropriate way to go on here
> `diagonal(copy=True)`. A more obscure alternative would be to add a
> separate method that returns a view.
> I don't think changing the default behavior in a later release is a good
> idea. It's a sort of an API wart, but IMHO better that than subtle code
> breakage.

Yes,  I think this is true.   We should add the copy keyword, but not change the API.     


> 	Pauli
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list