Description
Issue with current documentation:
The interface for the __array_finalize__
method in the ndarray
class for numpy v1.22.0 has no arguments:
Line 1499 in d64df45
However, the documentation for subclassing an ndarray
states that __array_finalize__
has one argument called obj
.
I have code that subclasses ndarray
following the documentation (so it takes the argument called obj
), and it appears to work with numpy v1.22.0; however, it doesn't pass type checking with mypy due to it having a different type signature than the superclass.
Note that subclasses of ndarray
in the interface (e.g., recarray
) use the single argument in the __array_finalize__
method.
Which is correct? Or is something more complicated going on under the hood that makes them both correct?
I checked the devdocs and this issue is present in them as well.
Idea or request for content:
Fix the ndarray
interface to have one argument or add a disclaimer to the subclassing documentation if something more complicated is going on under the hood.