MCPcopy
hub / github.com/numpy/numpy / _scalarfunc

Method _scalarfunc

numpy/lib/_user_array_impl.py:209–214  ·  view source on GitHub ↗
(self, func)

Source from the content-addressed store, hash-verified

207 return self._rc(invert(self.array))
208
209 def _scalarfunc(self, func):
210 if self.ndim == 0:
211 return func(self[0])
212 else:
213 raise TypeError(
214 "only rank-0 arrays can be converted to Python scalars.")
215
216 def __complex__(self):
217 return self._scalarfunc(complex)

Callers 5

__complex__Method · 0.95
__float__Method · 0.95
__int__Method · 0.95
__hex__Method · 0.95
__oct__Method · 0.95

Calls 1

funcFunction · 0.70

Tested by

no test coverage detected