[Numpy-discussion] Unfortunate user experience with max()

Keith Goodman kwgoodman at gmail.com
Wed May 16 21:36:12 EDT 2007


On 5/16/07, Anne Archibald <peridot.faceted at gmail.com> wrote:
> Numpy has a max() function. It takes an array, and possibly some extra
> arguments (axis and default). Unfortunately, this means that
>
> >>> numpy.max(-1.3,2,7)
> -1.3
>
> This can lead to surprising bugs in code that either explicitly
> expects it to behave like python's max() or implicitly expects that by
> doing "from numpy import max".

I have several bite marks from

>> x
matrix([[ 2.        ],
        [        nan],
        [ 1.        ]])
>> numpy.max(x)
1.0



More information about the NumPy-Discussion mailing list