summaryrefslogtreecommitdiff
path: root/numpy/core/overrides.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2018-09-23 20:59:11 -0700
committerStephan Hoyer <shoyer@google.com>2018-09-23 20:59:11 -0700
commitac2e2f3cb3c2f6fb8424abc48a9509d32011360d (patch)
treea9b290c7c3a1f8bff5eee8bc56f6c3b6616bc2f2 /numpy/core/overrides.py
parent234ca8957f444cea408e093a01bbb43108b6c4c7 (diff)
downloadnumpy-ac2e2f3cb3c2f6fb8424abc48a9509d32011360d.tar.gz
Add comment on subclasses ordering
Diffstat (limited to 'numpy/core/overrides.py')
-rw-r--r--numpy/core/overrides.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py
index 8f7676f66..06e005102 100644
--- a/numpy/core/overrides.py
+++ b/numpy/core/overrides.py
@@ -26,6 +26,9 @@ def get_overloaded_types_and_args(relevant_args):
overloaded_types.append(arg_type)
if array_function is not ndarray.__array_function__:
+ # By default, insert this argument at the end, but if it is
+ # subclass of another argument, insert it before that argument.
+ # This ensures "subclasses before superclasses".
index = len(overloaded_args)
for i, old_arg in enumerate(overloaded_args):
if issubclass(arg_type, type(old_arg)):