[Numpy-discussion] Adding keyword to asarray and asanyarray.

Charles R Harris charlesr.harris at gmail.com
Thu Mar 5 11:40:20 EST 2015


Hi All,

This is apropos gh-5634 <https://github.com/numpy/numpy/pull/5634>, a PR
adding a precision keyword to asarray and asanyarray. The PR description is

 The precision keyword differs from the current dtype keyword in the
> following way.
>
>    - It specifies a minimum precision. If the precision of the input is
>    greater than the specified precision, the input precision is preserved.
>    - Complex types are preserved. A specifies floating precision applies
>    to the dtype of the real and complex parts separately.
>
> For example, both complex128 and float64 dtypes have the
> same precision and an array of dtype float64 will be unchanged if the
> specified precision is float32.
>
> Ideally the precision keyword would be pushed down into the array
> constructor so that the resulting dtype could be determined before the
> array is constructed, but that would require adding new functions as the
> current constructors are part of the API and cannot have their
> signatures changed.
>
The name of the keyword is open to discussion, as well as its acceptable
values. And of course, anything else that might come to mind ;)

Thoughts?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150305/131d56d9/attachment.html>


More information about the NumPy-Discussion mailing list