1 Mar 2006 02:00
Re: subclassing ndaray
Colin J. Williams <cjw <at> sympatico.ca>
2006-03-01 01:00:51 GMT
2006-03-01 01:00:51 GMT
Travis Oliphant wrote: > >> Travis Oliphant wrote: >> >>> 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. >> >> >> >> Why this change in style from the the common Python idom of __new__, >> __init__, with the same signature to __new__, __array_finalize__ with >> possibly different signatures? >> > > I don't see it as a change in style but adding a capability to the(Continue reading)
RSS Feed