Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Marten van Kerkwijk
Hi Nathaniel, You're right, I shouldn't be righteous. Though I do think the advantage of `asanyarray` inside numpy is remains that it is easy for a user to add `asarray` to their input to a numpy function, and not easy for a happily compatible subclass to avoid an `asarray` inside a numpy function

Re: [Numpy-discussion] Proposal of timeline for dropping Python 2.7 support

2017-11-07 Thread Nathaniel Smith
On Nov 7, 2017 2:15 PM, "Chris Barker" wrote: On Mon, Nov 6, 2017 at 6:14 PM, Charles R Harris wrote: > Also -- if py2.7 continues to see the use I expect it will well past when >>> pyton.org officially drops it, I wouldn't be surprised if a Python2.7 >>> Windows build based on a newer compiler

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Nathaniel Smith
On Nov 6, 2017 4:19 PM, "Chris Barker" wrote: On Sat, Nov 4, 2017 at 6:47 AM, Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote: > > You just summarized excellently why I'm on a quest to change `asarray` > to `asanyarray` within numpy +1 -- we should all be using asanyarray() most of the

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Stephan Hoyer
On Tue, Nov 7, 2017 at 12:23 PM Chris Barker wrote: > > And then a third abc for indexing support, although, I am not sure how >> that could get implemented... > > > This is the really tricky one -- all ABCs really check is the existence of > methods -- making sure they behave the same way is up

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Ryan May
On Tue, Nov 7, 2017 at 1:20 PM, Chris Barker wrote: > On Mon, Nov 6, 2017 at 4:28 PM, Stephan Hoyer wrote: > >> >>> What's needed, though, is not just a single ABC. Some thought and design >>> needs to go into segmenting the ndarray API to declare certain behaviors, >>> just like was done for co

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Chris Barker
On Mon, Nov 6, 2017 at 4:28 PM, Stephan Hoyer wrote: > >> What's needed, though, is not just a single ABC. Some thought and design >> needs to go into segmenting the ndarray API to declare certain behaviors, >> just like was done for collections: >> >> https://docs.python.org/3/library/collection

Re: [Numpy-discussion] Proposal of timeline for dropping Python 2.7 support

2017-11-07 Thread Chris Barker
On Mon, Nov 6, 2017 at 6:14 PM, Charles R Harris wrote: > Also -- if py2.7 continues to see the use I expect it will well past when >>> pyton.org officially drops it, I wouldn't be surprised if a Python2.7 >>> Windows build based on a newer compiler would come along -- perhaps by >>> Anaconda or

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Marten van Kerkwijk
Hi Benjamin, For the shapes and reshaping, I wrote an ShapedLikeNDArray mixin/ABC for astropy, which may be a useful starting point as it also provides a way to implement the methods ndarray uses to reshape and get elements: see https://github.com/astropy/astropy/blob/master/astropy/utils/misc.py

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-07 Thread Benjamin Root
Well, to get the ball rolling a bit, the key thing that matplotlib needs to know is if `shape`, `reshape`, 'size', broadcasting, and logical indexing is respected. So, I see three possible abc's here: one for attribute access (things like `shape` and `size`) and another for shape manipulations (bro