2.2.17. czekitout.convert.to_multi_dim_slice

to_multi_dim_slice(obj, obj_name)[source]

Convert a multi-dimensional slice-like input object to a multi-dimensional slice object.

We define a multi-dimensional slice-like object as a sequence of items which contains at most one item being a sequence of integers, and the remaining items being slice objects and/or integers.

We define a multi-dimensional slice object as a tuple of items which contains at most one item being a list of integers, and the remaining items being slice and/or int objects.

If the input object is not multi-dimensional slice-like, then a TypeError exception is raised with the message:

The object ``<obj_name>`` must be a sequence of items which contains at 
most one item being a sequence of integers, and the remaining items 
being `slice` objects and/or integers.

where <obj_name> is replaced by the contents of the string obj_name.

Parameters:
objany type

Input object.

obj_namestr

Name of the input object.

Returns:
resulttuple (int | list (int) | slice)

The object resulting from the conversion.