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

Method _scalarfunc

numpy/lib/user_array.py:182–187  ·  view source on GitHub ↗
(self, func)

Source from the content-addressed store, hash-verified

180 return self._rc(invert(self.array))
181
182 def _scalarfunc(self, func):
183 if self.ndim == 0:
184 return func(self[0])
185 else:
186 raise TypeError(
187 "only rank-0 arrays can be converted to Python scalars.")
188
189 def __complex__(self):
190 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