[Numpy-discussion] .M .A .T .H attribute result

Travis Oliphant oliphant at ee.byu.edu
Fri Jul 7 15:21:44 CDT 2006

I didn't compile the results, but the discussion on the idea of adding 
new attributes to the array object led to the following result.

Added:  .T attribute to mean self.transpose()


This was rather controversial with many possibilities emerging.  In the 
end, I think the common case of going back and forth between C-order and 
Fortran-order codes in a wide variety of settings convinced me to make 
.T  a short-hand for .transpose() and add it as an attribute.   This is 
now the behavior in SVN.

Right now, for self.ndim < 2, this just returns a new reference to self 
(perhaps it should return a new view instead).


While some were in favor, too many people opposed this (although the 
circular reference argument was not convincing).  Instead a 
numpy.matlib  module was started to store matrix versions of the 
standard array-creation functions and mat was re-labeled to "asmatrix" 
so that a copy is not made by default.


A few were in favor, but as this is just syntactic sugar for 
.__array__() or asarray(obj) or .view(ndarray) it was thrown out because 
it is not used enough to add an additional attribute


A few were in favor, but this can now be written .T.conj()  which is not 
bad so does not get a new attribute.


More information about the Numpy-discussion mailing list