def _flatten(value): t = type(value) if t in (list, tuple): return _concatenate(map(_flatten, value)) elif t is dict: return _concatenate(_flatten(value[k]) for k in sorted(value)) else: return np.ravel(value)
def array(A, *args, **kwargs): t = builtins.type(A) if t in (list, tuple): return array_from_args(args, kwargs, *map(array, A)) else: return _array_from_scalar_or_array(args, kwargs, A)
def array(A, *args, **kwargs): t = builtins.type(A) if t in (list, tuple): return array_from_args(args, kwargs, *map(array, A)) else: return _array_from_scalar_or_array(args, kwargs, A)
def array(A, *args, **kwargs): t = builtins.type(A) if t in (list, tuple): return array_from_args(args, kwargs, *map(lambda a: a if a.shape else a.item(), map(array, A))) else: return _array_from_scalar_or_array(args, kwargs, A)