[Numpy-discussion] sort method raises unexpected error with axis=None

Matthew Brett matthew.brett@gmail....
Sun Feb 10 13:50:52 CST 2008


Hi,

I just noticed this:

>From the sort method docstring:

    axis : integer
        Axis to be sorted along. None indicates that the flattened array
        should be used. Default is -1.

In [40]: import numpy as N

In [41]: a = N.arange(10)

In [42]: N.sort(a, None)
Out[42]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

In [43]: a.sort(None)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/mb312/<ipython console> in <module>()

TypeError: an integer is required


Perhaps the sort method is calling the c code directly, and this is
not checking for axis=None?

Matthew


More information about the Numpy-discussion mailing list