[Numpy-discussion] proper use of __new__

Matthew Brett matthew.brett@gmail....
Tue Jul 21 13:41:15 CDT 2009


>> 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?

Yes, here's the link:


I remember the argument now.  Sturla Molden was pointing out that iff
you modify attributes at the class level in __new__, this is not
thread safe - as happens with any global variable.  Usually of course
you don't modify class attributes in the __new__ method, and in that
case, expect no subclass threading problems.  The key post from Travis



More information about the NumPy-Discussion mailing list