[Numpy-discussion] NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
Hi all, I would like to share the first formal draft of NEP 50: Promotion rules for Python scalars with everyone. The full text can be found here: https://numpy.org/neps/nep-0050-scalar-promotion.html NEP 50 is an attempt to remove value-based casting/promotion. We wish to replace it

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Ralf Gommers
On Wed, Jun 1, 2022 at 5:51 PM Sebastian Berg wrote: > > An important part of moving forward will be assessing the real world > impact. To start that process, I have created a branch as a draft PR > (at this time): > > https://github.com/numpy/numpy/pull/21626 > > It is missing some parts, b

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
On Wed, 2022-06-01 at 20:23 +0200, Ralf Gommers wrote: > On Wed, Jun 1, 2022 at 5:51 PM Sebastian Berg > > wrote: > > > > > An important part of moving forward will be assessing the real > > world > > impact.  To start that process, I have created a branch as a draft > > PR > > (at this time): >

[Numpy-discussion] Small API addition: unique now has `equal_nan=False` keyword argument

2022-06-01 Thread Sebastian Berg
Hi all, this has been discussed before, so mainly a brief announcement that we merged a PR to add the `equal_nan` kwarg to `np.unique`. If set to False, multiple `NaN`s will be reported multiple times (which was the behavior prior to NumPy 1.21). The keyword argument name was chosen to match tha

[Numpy-discussion] API Addition: Polynomial classes now have a "symbol" denoting the variable

2022-06-01 Thread Sebastian Berg
Hi all, just another small API announcement, that I merged: https://github.com/numpy/numpy/pull/16154 which adds `symbol="x"` to the polynomial classes. Ross' more detailed explanation is copied below. Cheers, Sebastian New attribute ``symbol`` added to polynomial classes -

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Juan Nunez-Iglesias
> For example, in NumPy: > >np.median(np.float32([1, 2, 3, 4])) > > did return a float64 before and will now return a float32. I assume > because somewhere we write: `(np.float64(3) + np.float32(2)) / 2`. Sorry, I missed this part of the discussion — I know the discussion centered around P

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
On Wed, 2022-06-01 at 18:37 -0500, Juan Nunez-Iglesias wrote: > > For example, in NumPy: > > > >    np.median(np.float32([1, 2, 3, 4])) > > > > did return a float64 before and will now return a float32.  I > > assume > > because somewhere we write: `(np.float64(3) + np.float32(2)) / 2`. > > Sorr