You can preserve this with (for example) __array_ufunc__. On

18/05/2018 at 18:57, Nathan wrote: 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 <

[hidden email]>

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

[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion_______________________________________________

NumPy-Discussion mailing list

[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion