MCPcopy Create free account
hub / github.com/numpy/numpy / __sub__

Method __sub__

numpy/array_api/_array_object.py:755–764  ·  view source on GitHub ↗

Performs the operation __sub__.

(self: Array, other: Union[int, float, Array], /)

Source from the content-addressed store, hash-verified

753 self._array.__setitem__(key, asarray(value)._array)
754
755 def __sub__(self: Array, other: Union[int, float, Array], /) -> Array:
756 """
757 Performs the operation __sub__.
758 """
759 other = self._check_allowed_dtypes(other, "numeric", "__sub__")
760 if other is NotImplemented:
761 return other
762 self, other = self._normalize_two_args(self, other)
763 res = self._array.__sub__(other._array)
764 return self.__class__._new(res)
765
766 # PEP 484 requires int to be a subtype of float, but __truediv__ should
767 # not accept int.

Callers

nothing calls this directly

Calls 3

_check_allowed_dtypesMethod · 0.95
_normalize_two_argsMethod · 0.95
_newMethod · 0.80

Tested by

no test coverage detected