[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Sebastian Berg
On Thu, 2022-09-08 at 23:19 -0700, Stefan van der Walt wrote: > I am in favor of such a change. It will make what is returned more > transparent to users (and reduce confusion for newcomers). > > With NEP50, we're already adopting a philosophy of explicit scalar > usage anyway: no longer

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Sebastian Berg
On Thu, 2022-09-08 at 21:15 -0400, Warren Weckesser wrote: > On 9/8/22, Andrew Nelson wrote: > > > > > For many types, this function makes an attempt to return a string > > that would yield an object with the same value when passed to > > eval(); > > Sebastian, is this an explicit goal of

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Evgeni Burovski
A naive question: what actually are the differences, what an end user need to worry about when mixing python scalars and numpy scalars? Same question about a library author. Or is it mainly about fixed-width integers vs python integers? Cheers, Evgeni пт, 9 сент. 2022 г., 09:58 Kevin Sheppard :

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Kevin Sheppard
+1 from me. They are a frequent source of confusion when starting, and there appear to be far fewer now then in earlier releases. It also might make it easier to spot any inadvertent scalars coming out if these could be Python floats. Kevin On Fri, Sep 9, 2022, 07:23 Stefan van der Walt

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Stefan van der Walt
I am in favor of such a change. It will make what is returned more transparent to users (and reduce confusion for newcomers). With NEP50, we're already adopting a philosophy of explicit scalar usage anyway: no longer pretending or trying to make transparent that Python floats and NumPy floats

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Matti Picus
On 9/9/22 04:15, Warren Weckesser wrote: ... To quote from https://docs.python.org/3/library/functions.html#repr: For many types, this function makes an attempt to return a string that would yield an object with the same value when passed to eval(); Sebastian, is this an explicit goal of

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Alexander Heger
+1 from me. That would be really helpful. On Fri, 9 Sept 2022 at 05:18, Stephan Hoyer wrote: > On Thu, Sep 8, 2022 at 3:41 AM Stefano Miccoli > wrote: > >> On 8 Sep 2022, at 11:39, numpy-discussion-requ...@python.org wrote: >> >> TL;DR: NumPy scalars representation is e.g. `34.3` instead of

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Stephan Hoyer
On Thu, Sep 8, 2022 at 3:41 AM Stefano Miccoli wrote: > On 8 Sep 2022, at 11:39, numpy-discussion-requ...@python.org wrote: > > TL;DR: NumPy scalars representation is e.g. `34.3` instead of > `float32(34.3)`. So the representation is missing the type > information. What are your thoughts on

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Andrew Nelson
On Thu, 8 Sept 2022, 19:42 Sebastian Berg, wrote: > > TL;DR: NumPy scalars representation is e.g. `34.3` instead of > `float32(34.3)`. So the representation is missing the type > information. What are your thoughts on changing that? > From the Python documentation on repr: >From the

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Sebastian Berg
On Thu, 2022-09-08 at 10:53 +0100, Peter Cock wrote: > Hello Sebastian, > > I rarely use NumPy scalars directly, but the repr change could > have impact in assorted downstream projects' documentation. > > For clarity, this idea would not alter how NumPy arrays print, > would it - since they

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Peter Cock
Hello Sebastian, I rarely use NumPy scalars directly, but the repr change could have impact in assorted downstream projects' documentation. For clarity, this idea would not alter how NumPy arrays print, would it - since they already include the type information? >>> np.array([34.3, 10.1, -0.5],