[Numpy-discussion] subclassing ndaray
oliphant at ee.byu.edu
Mon Feb 27 11:26:04 CST 2006
Stefan van der Walt wrote:
>>The __init__ and __new__ methods are not called because they may have
>>arbitrary signatures. Instead, the __array_finalize__ method is always
>>called. So, you should use that instead of __init__.
This is now true in SVN. Previously, __array_finalize__ was not called
if the "parent" was NULL. However, now, it is still called with None as
the value of the first argument.
Thus __array_finalize__ will be called whenever ndarray.__new__(<some
subclass>,...) is called.
More information about the Numpy-discussion