summaryrefslogtreecommitdiff
path: root/numpy/lib/mixins.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-05-08 01:24:36 +0100
committerGitHub <noreply@github.com>2017-05-08 01:24:36 +0100
commit11f3ebf86a16452d0af40b41925b201485ae7f9c (patch)
tree1a30506812d8dd63ca8d7119c6b51944ef370e6c /numpy/lib/mixins.py
parentd7d1b2a7297a680164e216f96905047ca1a2051f (diff)
parent8fbf75e499196c05da46302f035909897c9ec272 (diff)
downloadnumpy-11f3ebf86a16452d0af40b41925b201485ae7f9c.tar.gz
Merge pull request #9063 from shoyer/divmod
ENH: add np.divmod ufunc
Diffstat (limited to 'numpy/lib/mixins.py')
-rw-r--r--numpy/lib/mixins.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/lib/mixins.py b/numpy/lib/mixins.py
index bbeed1437..fbdc2edfb 100644
--- a/numpy/lib/mixins.py
+++ b/numpy/lib/mixins.py
@@ -70,8 +70,7 @@ class NDArrayOperatorsMixin(object):
implement.
This class does not yet implement the special operators corresponding
- to ``divmod`` or ``matmul`` (``@``), because these operation do not yet
- have corresponding NumPy ufuncs.
+ to ``matmul`` (``@``), because ``np.matmul`` is not yet a NumPy ufunc.
It is useful for writing classes that do not inherit from `numpy.ndarray`,
but that should support arithmetic and numpy universal functions like
@@ -161,7 +160,10 @@ class NDArrayOperatorsMixin(object):
um.true_divide, 'truediv')
__floordiv__, __rfloordiv__, __ifloordiv__ = _numeric_methods(
um.floor_divide, 'floordiv')
- __mod__, __rmod__, __imod__ = _numeric_methods(um.mod, 'mod')
+ __mod__, __rmod__, __imod__ = _numeric_methods(um.remainder, 'mod')
+ __divmod__ = _binary_method(um.divmod, 'divmod')
+ __rdivmod__ = _reflected_binary_method(um.divmod, 'divmod')
+ # __idivmod__ does not exist
# TODO: handle the optional third argument for __pow__?
__pow__, __rpow__, __ipow__ = _numeric_methods(um.power, 'pow')
__lshift__, __rlshift__, __ilshift__ = _numeric_methods(