[Numpy-discussion] Re: Making `T` property Array API compatible

2025-04-14 Thread Marten van Kerkwijk
As one of the ones who argued (perhaps too) vociferously previously that .T transposing all axes was a mistake and that it should just be the last two, yes, let's deprecate for all but 2-d arrays (i.e., also warning for 0 and 1). Ideally, eventually (numpy 3.0?) it can replace `.mT`, but also fine

[Numpy-discussion] Re: Making `T` property Array API compatible

2025-04-14 Thread Lucas Colley via NumPy-Discussion
If NumPy were to make a move on the deprecation, then I think it would be reasonable to change the standard from > If the array instance is not two-dimensional, an error should be raised. to “if the array instance is not two-dimensional, behaviour should match `.mT`, or an error should be raise

[Numpy-discussion] Re: Making `T` property Array API compatible

2025-04-14 Thread Sebastian Berg
On Sat, 2025-04-12 at 10:10 +, Mateusz Sokol wrote: > Hi all! > > The Array API standard states that `T` property should only be > applied to 2-dimensional arrays, in all other cases it should raise > an error: > https://data-apis.org/array-api/latest/API_specification/generated/array_api.arra

[Numpy-discussion] Re: Making `T` property Array API compatible

2025-04-12 Thread Ralf Gommers via NumPy-Discussion
On Sat, Apr 12, 2025 at 12:13 PM Mateusz Sokol wrote: > Hi all! > > The Array API standard states that `T` property should only be applied to > 2-dimensional arrays, in all other cases it should raise an error: > > https://data-apis.org/array-api/latest/API_specification/generated/array_api.array

[Numpy-discussion] Re: Making `T` property Array API compatible

2025-04-12 Thread Lucas Colley via NumPy-Discussion
> The new discrepancy between `arr.T` and `arr.transpose()` is justified, as > `T` is defined by the Array API, where `transpose` isn't and should retain > the existing behavior. The other side of the coin here is that this change would fix the discrepancy between `arr.T` and the functions `np.ma