Just for completeness: this is *not* an issue for ndarray subclasses,
but only for people attempting to write duck arrays.  One might want
to start by mimicking `empty_like` - not too different from
`np.positive(a, where=False)`. Will note that that is 50 times slower
for small arrays since it actually does the copying - it just doesn't
store the results. It is comparable in time to np.zeros_like and
np.ones_like, suggesting
that a ufunc implementation is not necessarily a bad thing.

As I noted above, the main problem I see is that the ufunc mechanism
doesn't easily work with strings and voids/structured dtypes.

-- Marten
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to