On Dec 11, 2007 2:32 AM, Hans Meine <
meine@informatik.uni-hamburg.de> wrote:
Am Montag, 10. Dezember 2007 23:46:17 schrieb Timothy Hochberg:
> > TypeError: function takes at least 2 arguments (1 given)
> >
> > (I could simulate that by passing max = maximum_value_of(
a.dtype), if
> > that existed, see my other mail.)
>
> Why not just use minimum or maximum as needed instead of overloading clip?
You mean one of the following?
a.clip(min = 10, max =
numpy.finfo(a.dtype).max)
a.clip(min = 10, max = numpy.iinfo(a.dtype).max)
No. I mean:
numpy.maximum(a, 10)
To correspond to the above example.
Three reasons:
- this is not very concise
- it is less efficient than specialized clip variants
(not much / too important though)
- I would have to discriminate integral and floating point types
How is the latter done in numpy? Is there a good reason not to have
numpy.rangetraits(sometype) with min/max as in iinfo/finfo?
Should I use isinstance(mytype, int)?
--