[Numpy-discussion] __array_wrap__ and dot

2012-08-22 Thread Aronne Merrelli
Hello list, I posted an issue many months ago [1] about confusing __array_wrap__ behavior in a subclass of np.matrix. Since that time I wasn't really using the code that used the matrix subclass, but lately I have starting using the code so I've run into the issue again. Looking into a little more

[Numpy-discussion] __array_wrap__ / __array_finalize__ in NumPy v1.4+

2011-08-14 Thread Aronne Merrelli
Hello, I'm attempting to implement a subclass of ndarray, and becoming confused about the way __array_wrap__ and __array_finalize__ operate. I boiled it down to a short subclass, which is the example on the website at http://docs.scipy.org/doc/numpy-1.6.0/user/basics.subclassing.html, with one add

Re: [Numpy-discussion] __array_wrap__

2009-09-30 Thread Darren Dale
On Wed, Sep 30, 2009 at 2:57 AM, Pauli Virtanen wrote: > Tue, 29 Sep 2009 14:55:44 -0400, Neal Becker wrote: > >> This seems to work now, but I'm wondering if Charles is correct, that >> inheritance isn't such a great idea here. >> >> The advantage of inheritance is I don't have to implement forwa

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Pauli Virtanen
Tue, 29 Sep 2009 14:55:44 -0400, Neal Becker wrote: > This seems to work now, but I'm wondering if Charles is correct, that > inheritance isn't such a great idea here. > > The advantage of inheritance is I don't have to implement forwarding all > the functions, a pretty big advantage. (I wonder i

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 1:12 PM, Robert Kern wrote: > On Tue, Sep 29, 2009 at 14:08, Charles R Harris > wrote: > > > > > > On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern > wrote: > >> > >> On Tue, Sep 29, 2009 at 13:35, Charles R Harris > >> wrote: > >> > > >> > On Tue, Sep 29, 2009 at 12:23 PM

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Robert Kern
On Tue, Sep 29, 2009 at 14:08, Charles R Harris wrote: > > > On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern wrote: >> >> On Tue, Sep 29, 2009 at 13:35, Charles R Harris >> wrote: >> > >> > On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern >> > wrote: >> >> >> >> On Tue, Sep 29, 2009 at 13:09, Charle

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern wrote: > On Tue, Sep 29, 2009 at 13:35, Charles R Harris > wrote: > > > > On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern > wrote: > >> > >> On Tue, Sep 29, 2009 at 13:09, Charles R Harris > >> wrote: > >> > > >> > > >> > On Tue, Sep 29, 2009 at 11:0

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 12:55 PM, Neal Becker wrote: > This seems to work now, but I'm wondering if Charles is correct, that > inheritance isn't such a great idea here. > > The advantage of inheritance is I don't have to implement forwarding all > the > functions, a pretty big advantage. (I wonde

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Neal Becker
This seems to work now, but I'm wondering if Charles is correct, that inheritance isn't such a great idea here. The advantage of inheritance is I don't have to implement forwarding all the functions, a pretty big advantage. (I wonder if there is some way to do some of these as a generic 'mixin'

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Robert Kern
On Tue, Sep 29, 2009 at 13:35, Charles R Harris wrote: > > On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern wrote: >> >> On Tue, Sep 29, 2009 at 13:09, Charles R Harris >> wrote: >> > >> > >> > On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker >> > wrote: >> >> >> >> fixed_pt arrays need to apply the

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern wrote: > On Tue, Sep 29, 2009 at 13:09, Charles R Harris > wrote: > > > > > > On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker > wrote: > >> > >> fixed_pt arrays need to apply the overflow_policy after operations > >> (overflow_policy could be clip, or

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 12:35 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern wrote: > >> On Tue, Sep 29, 2009 at 13:09, Charles R Harris >> wrote: >> > >> > >> > On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker >> wrote: >> >> >> >> fixe

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Robert Kern
On Tue, Sep 29, 2009 at 13:09, Charles R Harris wrote: > > > On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker wrote: >> >> fixed_pt arrays need to apply the overflow_policy after operations >> (overflow_policy could be clip, or throw exception). >> >> I thought __array_wrap__ would work for this, bu

Re: [Numpy-discussion] __array_wrap__

2009-09-29 Thread Charles R Harris
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker wrote: > fixed_pt arrays need to apply the overflow_policy after operations > (overflow_policy could be clip, or throw exception). > > I thought __array_wrap__ would work for this, but it seems to not be called > when I need it. For example: > > In [

[Numpy-discussion] __array_wrap__

2009-09-29 Thread Neal Becker
fixed_pt arrays need to apply the overflow_policy after operations (overflow_policy could be clip, or throw exception). I thought __array_wrap__ would work for this, but it seems to not be called when I need it. For example: In [13]: obj Out[13]: fixed_pt_array([ 0, 32, 64, 96, 128]) In [