[Numpy-discussion] What type should / return in python 3kwhen applied to two integer types?
Citi, Luca
lciti at essex.ac.uk
Fri Aug 28 11:47:52 EDT 2009
> The main issue is probably just choosing an appropriate float return
> type, and personally I believe this should be same as numpy's default
> float.
I completely agree.
Maybe we could let the user decide whether to use a different type.
It is already somehow possible through the "out" argument.
>>> np.true_divide(a, b, np.empty(a.shape, dtype=np.float32))
but clearly a but clumsy.
Alan Isaac suggested:
"""
Is there a reason not to make
the `out` argument a keyword argument
and then also alternatively allow
a dtype specification?
"""
As one needs to specify EITHER the output array OR the type,
is it possible to use a type as "out" argument?
Something like:
>>> np.true_divide(a, b, np.float32)
that, instead of raising "return arrays must be of ArrayType"
could, if "out" is a valid type, create the corresponding array,
use it and return it.
More information about the NumPy-Discussion
mailing list