Re: [Numpy-discussion] new NEP: np.AbstractArray and np.asabstractarray

2018-03-22 Thread Nathaniel Smith
On Sat, Mar 10, 2018 at 4:27 AM, Matthew Rocklin wrote: > I'm very glad to see this discussion. > > I think that coming up with a single definition of array-like may be > difficult, and that we might end up wanting to embrace duck typing instead. > > It seems to me that different array-like classe

[Numpy-discussion] 3D array slicing bug?

2018-03-22 Thread Michael Himes
Hi, I have discovered what I believe is a bug with array slicing involving 3D (and higher) dimension arrays. When slicing a 3D array by a single value for axis 0, all values for axis 1, and a list to slice axis 2, the dimensionality of the resulting 2D array is flipped. However, slicing more t

Re: [Numpy-discussion] 3D array slicing bug?

2018-03-22 Thread Pauli Virtanen
ke, 2018-03-21 kello 20:40 +, Michael Himes kirjoitti: > I have discovered what I believe is a bug with array slicing > involving 3D (and higher) dimension arrays. When slicing a 3D array > by a single value for axis 0, all values for axis 1, and a list to > slice axis 2, the dimensionality of

Re: [Numpy-discussion] new NEP: np.AbstractArray and np.asabstractarray

2018-03-22 Thread Hameer Abbasi
I think that with your comments in mind, it may just be best to embrace duck typing, like Matthew suggested. I propose the following workflow: - __array_concatenate__ and similar "protocol" functions return NotImplemented if they won't work. - "Base functions" that can be called directly

Re: [Numpy-discussion] 3D array slicing bug?

2018-03-22 Thread Pauli Virtanen
ke, 2018-03-21 kello 20:40 +, Michael Himes kirjoitti: > I have discovered what I believe is a bug with array slicing > involving 3D (and higher) dimension arrays. When slicing a 3D array > by a single value for axis 0, all values for axis 1, and a list to > slice axis 2, the dimensionality of

Re: [Numpy-discussion] 3D array slicing bug?

2018-03-22 Thread Sebastian Berg
This NEP draft has some more hints/explanations if you are interested: https://github.com/seberg/numpy/blob/5becd12914d0402967205579d6f59a9815 1e0d98/doc/neps/indexing.rst#examples Plus, it tries to avoid the word "subspace" hehehe. - Sebastian On Thu, 2018-03-22 at 10:41 +0100, Pauli Virtanen

[Numpy-discussion] nditer as a context manager

2018-03-22 Thread Matti Picus
|Hello all, PR #9998 (https://github.com/numpy/numpy/pull/9998/) proposes an update to the nditer API, both C and python. The issue (link) is that |||sometimes nditer uses temp arrays via the "writeback" mechanism, the data is copied back to the original arrays "when finished". However "when fin

Re: [Numpy-discussion] nditer as a context manager (reformatted?)

2018-03-22 Thread Matti Picus
Hello all, PR #9998 (https://github.com/numpy/numpy/pull/9998/) proposes an update to the nditer API, both C and python. The issue (https://github.com/numpy/numpy/issues/9714) is that sometimes nditer uses temp arrays via the "writeback" mechanism, the data is copied back to the original arrays

[Numpy-discussion] round(numpy.float64(0.0)) is a numpy.float64

2018-03-22 Thread Olivier
Hello, Is it normal, expected and desired that : round(numpy.float64(0.0)) is a numpy.float64 while round(numpy.float(0.0)) is an integer? I find it disturbing and misleading. What do you think? Has it already been discussed somewhere else? Best regards, Olivier _

Re: [Numpy-discussion] round(numpy.float64(0.0)) is a numpy.float64

2018-03-22 Thread Nathan Goldbaum
numpy.float is an alias to the python float builtin. https://github.com/numpy/numpy/issues/3998 On Thu, Mar 22, 2018 at 2:26 PM Olivier wrote: > Hello, > > > Is it normal, expected and desired that : > > > round(numpy.float64(0.0)) is a numpy.float64 > > > while > > round(numpy.flo