Re: [Numpy-discussion] Suggestion: prevent silent downcast in np.full_like

2020-02-24 Thread Stefan van der Walt
Hi Alexis, On Mon, Feb 24, 2020, at 12:00, A T wrote: > Here is a summarized code example of how unsafe downcasting in np.full_like() > resulted in issues in our scientific toolbox: > > t0 = 20.5 > # We're trying to make a constant-valued "ufunc" > temperature = lambda x: np.full_like(x, t0) >

Re: [Numpy-discussion] New DTypes: Are scalars a central concept in NumPy or not?

2020-02-24 Thread Allan Haldane
I have some thoughts on scalars from playing with ndarray ducktypes (__array_function__), eg a MaskedArray ndarray-ducktype, for which I wanted an associated "MaskedScalar" type. In summary, the ways scalars currently work makes ducktyping (duck-scalars) difficult: * numpy scalar types are not

[Numpy-discussion] Suggestion: prevent silent downcast in np.full_like

2020-02-24 Thread A T
Hello, This is my first activity on this mailing list, please let me know if I am doing anything improperly. I recently opened issue #15635 and it was suggested to me that it could be worth discussing here. Here is a summarized code example of how