named_array_like#

named_arrays.named_array_like(a)#

Check if an object is compatible with the named_arrays API.

If the object has a __named_array_function__ method it is considered compatible.

Parameters:

a (Any) – Object to be checked for compatibility with the named_arrays API.

Return type:

bool

Examples

Instances of named_arrays.ScalarArray are compatible with the named_arrays API

import named_arrays as na

na.named_array_like(na.ScalarArray(2))
True

But instances of numpy.ndarray are not compatible

import numpy as np

na.named_array_like(np.empty(3))
False