[Numpy-discussion] ndarray.T2 for 2D transpose

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Apr 7 15:53:25 EDT 2016


On Thu, Apr 7, 2016 at 3:26 PM, Ian Henriksen <
insertinterestingnamehere at gmail.com> wrote:

> On Thu, Apr 7, 2016 at 12:31 PM <josef.pktd at 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




>
> Best,
> -Ian
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160407/f9f4f3b0/attachment.html>


More information about the NumPy-Discussion mailing list