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

Travis Oliphant travis at continuum.io
Wed May 16 16:15:10 EDT 2012

On May 13, 2012, at 3:11 AM, Nathaniel Smith wrote:

> On Sun, May 13, 2012 at 3:28 AM, Travis Oliphant <travis at continuum.io> wrote:
>> Another approach would be to introduce a method:
>> a.diag(copy=False)
>> and leave a.diagonal() alone.  Then, a.diagonal() could be deprecated over
>> 2-3 releases.
> This would be a good idea if we didn't already have both
> np.diagonal(a) (which is an alias for a.diagonal()) *and* np.diag(a),
> which do different things. And the new a.diag() would be different
> from the existing np.diag(a)...

I don't see how the new a.diag() would be different than np.diag(a) except for view semantics for 2-d arrays.   Is this really a problem? 


More information about the NumPy-Discussion mailing list