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

Method __int__

numpy/array_api/_array_object.py:577–587  ·  view source on GitHub ↗

Performs the operation __int__.

(self: Array, /)

Source from the content-addressed store, hash-verified

575 return self.__class__._new(res)
576
577 def __int__(self: Array, /) -> int:
578 """
579 Performs the operation __int__.
580 """
581 # Note: This is an error here.
582 if self._array.ndim != 0:
583 raise TypeError("int is only allowed on arrays with 0 dimensions")
584 if self.dtype in _complex_floating_dtypes:
585 raise TypeError("int is not allowed on complex floating-point arrays")
586 res = self._array.__int__()
587 return res
588
589 def __index__(self: Array, /) -> int:
590 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected