[Numpy-discussion] Functions vs Methods

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Dec 28 01:55:48 EST 2011


Hi Jaidev,

On Wed, Dec 28, 2011 at 12:09:45PM +0530, Jaidev Deshpande wrote:
> Eg.  x is a NumPy array, and I need its transpose

> Should I use

> >>> x.T

> or
> >>> numpy.transpose(T)   ?

If you are wondering for a timing reason, use IPython's '%timeit' magic
to figure out if it does make a difference or not.

In general, I tend to prefer 'x.T', which I find more readable.

Gael



More information about the NumPy-Discussion mailing list