On Thu, Apr 7, 2016 at 1:53 PM <josef.p...@gmail.com> wrote: > On Thu, Apr 7, 2016 at 3:26 PM, Ian Henriksen < > insertinterestingnameh...@gmail.com> wrote: > >> On Thu, Apr 7, 2016 at 12:31 PM <josef.p...@gmail.com> wrote: >> >>> write unit tests with non square 2d arrays and the exception / test >>> error shows up fast. >>> >>> Josef >>> >>> >> Absolutely, but good programming practices don't totally obviate helpful >> error >> messages. >> > > The current behavior is perfectly well defined, and I don't want a lot of > warnings showing up because .T works suddenly only for ndim != 1. > I make lots of mistakes during programming. But shape mismatch are usually > very fast to catch. > > If you want safe programming, then force everyone to use only 2-D like in > matlab. It would have prevented me from making many mistakes. > > >>> np.array(1).T > array(1) > > another noop. Why doesn't it convert it to 2d? > > Josef > > I think we've misunderstood each other. Sorry if I was unclear. As I've understood the discussion thus far, "raising an error" refers to raising an error when a 1D array is passed used with the syntax a.T2 (for swapping the last two dimensions?). As far as whether or not a.T should raise an error for 1D arrays, that ship has definitely already sailed. I'm making the case that there's value in having an abbreviated syntax that helps prevent errors from accidentally using a 1D array, not that we should change the existing semantics.
Cheers, -Ian
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion