[Numpy-discussion] Turn numpy.ones_like into a ufunc
Nathan Goldbaum
nathan12343 at gmail.com
Fri May 18 09:57:38 EDT 2018
I don't particularly need this, although it would be nice to make this
behavior explicit, instead of happening more or less by accident:
In [1]: from yt.units import km
In [2]: import numpy as np
In [3]: data = [1, 2, 3]*km
In [4]: np.ones_like(data)
Out[4]: YTArray([1., 1., 1.]) km
On Fri, May 18, 2018 at 9:51 AM, Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:
> I'm greatly in favour, especially if the same can be done for
> `zeros_like` and `empty_like`, but note that a tricky part is that
> ufuncs do not deal very graciously with structured (void) and string
> dtypes. -- Marten
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180518/3bd4ae55/attachment.html>
More information about the NumPy-Discussion
mailing list