[Numpy-discussion] Should non ufunc numpy functions behave like ufunc regarding casting to output argument ?
david at ar.media.kyoto-u.ac.jp
Mon Jan 15 19:36:09 CST 2007
I am trying to add support for out argument to one C function using
numpy API (still the clip function). I was wondering about the expected
behaviour when out does not have the "expected" type.
For example, using again the clip function (but the question is not
specific to this function)
In : import numpy
In : a = numpy.linspace(0, 10, 101)
In : b = numpy.zeros(a.shape, dtype = numpy.int32)
In : print a.dtype
In : a.clip(0.1, 0.5, b)
Should this be equivalent to b = a.clip(0.1, 0.5); b =
b.astype(numpy.int32) (ie, the casting is done at the end, similar to an
More information about the Numpy-discussion