[Numpy-discussion] proper use of __new__

Darren Dale dsdale24@gmail....
Tue Jul 21 13:24:40 CDT 2009

Hi Matthew,

On Tue, Jul 21, 2009 at 1:37 PM, Matthew Brett<matthew.brett@gmail.com> 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, calling __array_finalize__ without calling __new__). In the Simple
>> Example of the doc, if .info cannot be None but must have a default
>> DEFAULT, you should have a
>>  >>> self.info = getattr(obj, 'info', DEFAULT)
>> in your __array_finalize__
> 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
> there was not an increased threading problem with __new__  but
> understanding why it came up in the first place.  I can't now
> reconstruct that understanding, I could have a go if y'all want some
> summary...

Did this occur on the mailing list? Could you provide a link?


More information about the NumPy-Discussion mailing list