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

Method __bool__

numpy/array_api/_array_object.py:463–471  ·  view source on GitHub ↗

Performs the operation __bool__.

(self: Array, /)

Source from the content-addressed store, hash-verified

461 return array_api
462
463 def __bool__(self: Array, /) -> bool:
464 """
465 Performs the operation __bool__.
466 """
467 # Note: This is an error here.
468 if self._array.ndim != 0:
469 raise TypeError("bool is only allowed on arrays with 0 dimensions")
470 res = self._array.__bool__()
471 return res
472
473 def __complex__(self: Array, /) -> complex:
474 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected