Implement an in-place binary method with a ufunc, e.g., __iadd__.
(ufunc, name)
| 34 | |
| 35 | |
| 36 | def _inplace_binary_method(ufunc, name): |
| 37 | """Implement an in-place binary method with a ufunc, e.g., __iadd__.""" |
| 38 | def func(self, other): |
| 39 | return ufunc(self, other, out=(self,)) |
| 40 | func.__name__ = '__i{}__'.format(name) |
| 41 | return func |
| 42 | |
| 43 | |
| 44 | def _numeric_methods(ufunc, name): |