[Numpy-discussion] clip() with None as argument

Robert Kern robert.kern@gmail....
Tue Sep 7 15:22:45 CDT 2010


On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt
<friedrichromstedt@gmail.com> wrote:
> Ah, no need to answer, I do this myself:
>
> Friedrich, would you please use numpy.inf and -numpy.inf.

But if you have an integer array, you will run into the same problem.
The result will be upcast to float. I think we would accept a patch
that interprets None to be the appropriate extreme bound given the
input datatype. This will be tricky, though, since it must be done in
C (PyArray_Clip in numpy/core/src/multiarray/calculation.c).

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list