numpy.testing.overrides.allows_array_ufunc_override#

testing.overrides.allows_array_ufunc_override(func)[源代码]#

确定是否可以通过 `__ array_ufunc__ ` 重写函数

参数:
funccallable

可能可以通过 `__ array_ufunc__ ` 重写的函数

返回:
bool

如果可以通过 __ array_ufunc__ 重写 func ,则为 True ,否则为 False .

注释

此函数等效于 isinstance(func, np.ufunc) ,并且对于在 Numpy 之外定义的 ufunc 也能正确工作.