Implement a forward binary method with a ufunc, e.g., __add__.
(ufunc, name)
| 14 | |
| 15 | |
| 16 | def _binary_method(ufunc, name): |
| 17 | """Implement a forward binary method with a ufunc, e.g., __add__.""" |
| 18 | def func(self, other): |
| 19 | if _disables_array_ufunc(other): |
| 20 | return NotImplemented |
| 21 | return ufunc(self, other) |
| 22 | func.__name__ = '__{}__'.format(name) |
| 23 | return func |
| 24 | |
| 25 | |
| 26 | def _reflected_binary_method(ufunc, name): |
no outgoing calls
no test coverage detected