Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Darren Dale
On Tue, Jul 21, 2009 at 2:41 PM, Matthew Brett wrote: > Hi, > >>> I'm the person who removed the reference to thread-safeness in the >>> numpy version of the subclassing docs.   I remember at the time going >>> through all the email discussions that led up to the thread-safeness >>> question, and c

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Pierre GM
On Jul 21, 2009, at 2:23 PM, Darren Dale wrote: > >> Without access to your code, I'm likely to speak beyond myself here >> (could you send me a link to the latest version ?), but if you need >> to >> rescale the units, make sure it's done in __array_finalize__ as well, >> with something like >>

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Matthew Brett
Hi, >> I'm the person who removed the reference to thread-safeness in the >> numpy version of the subclassing docs.   I remember at the time going >> through all the email discussions that led up to the thread-safeness >> question, and concluding (in discussion with Travis O and others) that >> th

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Darren Dale
Hi Matthew, On Tue, Jul 21, 2009 at 1:37 PM, Matthew Brett wrote: > Hi, > >> The words of caution were intended to remind that setting the value >> of  new array attributes in __new__ only could lead to problems, as >> it's possible to transform a ndarray into a subclass with a view (that >> is, c

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Darren Dale
On Tue, Jul 21, 2009 at 1:26 PM, Pierre GM wrote: > > On Jul 21, 2009, at 10:58 AM, Darren Dale wrote: > >> http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray >> includes an example where an instance attribute is set in __new__ . >> Howe

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Matthew Brett
Hi, > The words of caution were intended to remind that setting the value > of  new array attributes in __new__ only could lead to problems, as > it's possible to transform a ndarray into a subclass with a view (that > is, calling __array_finalize__ without calling __new__). In the Simple > Exampl

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Pierre GM
On Jul 21, 2009, at 10:58 AM, Darren Dale wrote: > http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray > includes an example where an instance attribute is set in __new__ . > However, there is a warning at http://www.scipy.org/Subclasse

[Numpy-discussion] proper use of __new__

2009-07-21 Thread Darren Dale
http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray includes an example where an instance attribute is set in __new__ . However, there is a warning at http://www.scipy.org/Subclasses: - Some words of caution The definition in the __