[Numpy-discussion] What is .T?

Keith Goodman kwgoodman@gmail....
Tue May 6 14:37:57 CDT 2008


On Tue, May 6, 2008 at 12:28 PM, Robert Kern <robert.kern@gmail.com> wrote:
>
> On Tue, May 6, 2008 at 2:22 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
>  > What is .T? It looks like an attribute, behaves like a method, and
>  >  smells like magic. I'd like to add it to my class but don't no where
>  >  to begin.
>
>  It is a property. It returns the transpose of the array. If you had a
>  .transpose() method on your class already, you could do (in Python
>  2.4+)
>
>   @property
>   def T(self):
>       return self.transpose()

That works very nicely. Thank you.


More information about the Numpy-discussion mailing list