You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of API functions have common logic at the top of each implementation. For example, calling ndindex() on the input arguments, or type checking that is the same in every case.
We should refactor the common logic to the superclass, and have the methods call implementations in the subclasses. Something like
classSubclass(NDIndex):
def_method(self, arg):
# Subclass specific implementation
The only downside of this is that it makes it impossible to have subclass specific docstrings. Presently reduce and expand are the only methods with subclass specific docstrings, and I don't think they have any common logic, so they can be left alone. For other methods, we could have some way to automatically replace the docstrings with docstrings on the implementation methods.
The text was updated successfully, but these errors were encountered:
A lot of API functions have common logic at the top of each implementation. For example, calling
ndindex()
on the input arguments, or type checking that is the same in every case.We should refactor the common logic to the superclass, and have the methods call implementations in the subclasses. Something like
The only downside of this is that it makes it impossible to have subclass specific docstrings. Presently
reduce
andexpand
are the only methods with subclass specific docstrings, and I don't think they have any common logic, so they can be left alone. For other methods, we could have some way to automatically replace the docstrings with docstrings on the implementation methods.The text was updated successfully, but these errors were encountered: