Re: [Numpy-discussion] Creating a subclass that never propagates

2019-07-16 Thread Ralf Gommers
On Tue, Jul 16, 2019 at 5:58 AM Charles R Harris wrote: > > > On Tue, Jul 16, 2019 at 3:44 AM Kevin Sheppard > wrote: > >> I am trying to make a subclass that never propagates so that when >> interacted with another ndarray, or even itself so that the return type is >> always ndarray. Is this p

Re: [Numpy-discussion] Creating a subclass that never propagates

2019-07-16 Thread Charles R Harris
On Tue, Jul 16, 2019 at 3:44 AM Kevin Sheppard wrote: > I am trying to make a subclass that never propagates so that when > interacted with another ndarray, or even itself so that the return type is > always ndarray. Is this possible? > > I got pretty far with > > def __array_wrap__(self, out_ar

[Numpy-discussion] Creating a subclass that never propagates

2019-07-16 Thread Kevin Sheppard
I am trying to make a subclass that never propagates so that when interacted with another ndarray, or even itself so that the return type is always ndarray. Is this possible? I got pretty far with def __array_wrap__(self, out_arr, context=None): if out_arr.shape == (): return out_arr