Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Stephan Hoyer
With regards to np.where -- shouldn't where be a ufunc, so subclasses or other array-likes can be control its behavior with __numpy_ufunc__? As for the other indexing functions, I don't have a strong opinion about how they should handle subclasses. But it is certainly tricky to attempt to handl

Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Nathaniel Smith
On Sat, May 9, 2015 at 1:27 PM, Benjamin Root wrote: > > On Sat, May 9, 2015 at 4:03 PM, Nathaniel Smith wrote: >> >> Not sure what this has to do with Jaime's post about nonzero? There is >> indeed a potential question about what 3-argument where() should do with >> subclasses, but that's effect

Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Benjamin Root
On Sat, May 9, 2015 at 4:03 PM, Nathaniel Smith wrote: > Not sure what this has to do with Jaime's post about nonzero? There is > indeed a potential question about what 3-argument where() should do with > subclasses, but that's effectively a different operation entirely and to > discuss it we'd n

[Numpy-discussion] Proposed deprecations for 1.10: dot corner cases

2015-05-09 Thread Nathaniel Smith
Hi all, I'd like to suggest that we go ahead and add deprecation warnings to the following operations. This doesn't commit us to changing anything on any particular time scale, but it gives us more options later. 1) dot(A, B) where A and B *both* have *3 or more dimensions*: currently, this does

Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Nathaniel Smith
On May 9, 2015 12:54 PM, "Benjamin Root" wrote: > > Absolutely, it should be writable. As for subclassing, that might be messy. Consider the following: > > inds = np.where(data > 5) > > In that case, I'd expect a normal, bog-standard ndarray because that is what you use for indexing (although pand

Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Benjamin Root
Absolutely, it should be writable. As for subclassing, that might be messy. Consider the following: inds = np.where(data > 5) In that case, I'd expect a normal, bog-standard ndarray because that is what you use for indexing (although pandas might have a good argument for having it return one of t

Re: [Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Nathaniel Smith
On May 9, 2015 10:48 AM, "Jaime Fernández del Río" wrote: > > There is a reported bug (issue #5837) regarding different returns from np.nonzero with 1-D vs higher dimensional arrays. A full summary of the differences can be seen from the following output: > > >>> class C(np.ndarray): pass > ... >

[Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

2015-05-09 Thread Jaime Fernández del Río
There is a reported bug (issue #5837 ) regarding different returns from np.nonzero with 1-D vs higher dimensional arrays. A full summary of the differences can be seen from the following output: >>> class C(np.ndarray): pass ... >>> a = np.arange(6).view