[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Juan Nunez-Iglesias
> * e.g. the same user might initially be happy about the result of x[0] + 1 > matching their infinite-precision expectation, but then be surprised by > > x[0] + 1 > -> 256 > > y[0] = 1 > x[0] + y[0] > -> 0 # WTH I'll go even further: I would say a common situation where people use syntax lik

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Juan Nunez-Iglesias
On Tue, 22 Feb 2022, at 1:01 AM, Stefan van der Walt wrote: > it is easier to explain away `x + 1` behaving oddly over `x[0] + 1` behaving > oddly Is it? I find the two equivalent, honestly. > given that we pretend like NumPy scalars do not exist. This is the leaky abstraction that I think sho

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Juan Nunez-Iglesias
On Mon, 21 Feb 2022, at 11:50 PM, Stefan van der Walt wrote: > Just to play a bit of devil's advocate here, I'd have to say that most people > will not expect > > x[0] + 200 > > To often yield a number less than 200! It's tricky though, because I would expect np.uint8(255) + 1 to be equal to

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread David Menéndez Hurtado
On Tue, 22 Feb 2022, 6:53 am Stefan van der Walt, wrote: > On Mon, Feb 21, 2022, at 20:56, Juan Nunez-Iglesias wrote: > > > the > > latter would seem consistent with the "principle of least surprise" when > moving from a typed language to > > NumPy work perhaps, though arguably slightly less user

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Stefan van der Walt
On Mon, Feb 21, 2022, at 20:56, Juan Nunez-Iglesias wrote: > > the > > latter would seem consistent with the "principle of least surprise" when > > moving from a typed language to > > NumPy work perhaps, though arguably slightly less user-friendly if naively > > doing some operations with > > a l

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Juan Nunez-Iglesias
> the > latter would seem consistent with the "principle of least surprise" when > moving from a typed language to > NumPy work perhaps, though arguably slightly less user-friendly if naively > doing some operations with > a less formal view of typing (new Python user messing around with NumPy?)

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Tyler Reddy
I added a few comments on the PR. The main comments of substance I had boil down to: - consistency with other programming languages/major frameworks (perhaps a few more "examples of consistency" for the new approach with others may help strengthen the arguments?)--I know JAX was mentioned, and thei

[Numpy-discussion] NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Sebastian Berg
Hi all, NumPy has awkward behaviour when it comes to promotion with 0-D arrays, and Python scalars. This is both a technical challenge (numpy needs to inspect the values where it shouldn't), as well as surprising for users. Roughly speaking, I have made a proposal under the 3 points: * NumPy sca

[Numpy-discussion] 14ᵗʰ Advanced Scientific Programming in Python in Bilbao Spain, 5–11 September, 2022

2022-02-21 Thread Tiziano Zito
ASPP2022: 14ᵗʰ Advanced Scientific Programming in Python a Summer School by the ASPP faculty and the Faculty of Engineering of the Mondragon University, Bilbao https://aspp.school Scientists spend more and more time writing, maintaining,