[Numpy-discussion] .T Transpose shortcut for arrays again

Tim Hochberg tim.hochberg at cox.net
Thu Jul 6 16:23:03 EDT 2006


Alexander Belopolsky wrote:
> On 7/6/06, Tim Hochberg <tim.hochberg at cox.net> wrote:
>> ...
>> Overloading '+' sure seems perverse, but maybe that's just me.
>>
> The first time I saw it, it seemed perverse to me as well, but it
> actually make a lot of sense:
>
> 1. It is visually appealing as in '+' makes '|' from '-' and '-' from
> '|' and looks close enough to 't'.
It looks even closer to † (dagger if that doesn't make it through) which 
is the symbol used for the hermitian adjoint.
> 2. It puts an otherwise useless operator to work.
> 3. Prefix spelling suggests that it should be swapaxes(0,1) rather
> than swapaxes(-2,-1), which is the choice made by K.
> 4. You can't get any shorter than that (at least using a fixed width 
> font :-).
> 5. It already does the right thing for rank<2.
Perhaps it's not as perverse as it first appears. Although I still don't 
have to like it ;-)

-tim

>
>






More information about the NumPy-Discussion mailing list