2.2.41. czekitout.convert.to_single_dim_slice
- to_single_dim_slice(obj, obj_name)[source]
Convert a one-dimensional slice-like input object to a one-dimensional slice object.
We define a one-dimensional slice-like object as any object that is an integer, a sequence of integers, or a slice object.
We define a one-dimensional slice object as any object that is an integer, a list of integers, or a slice object.
If the input object is not one-dimensional slice-like, then a TypeError exception is raised with the message:
The object ``<obj_name>`` must be an integer, a sequence of integers, or a `slice` object.
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:
- resultint | list (int) | slice
The object resulting from the conversion.