I’m wading through Python’s ast module and can’t figure out the slices definition:
slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step)
| ExtSlice(slice* dims)
| Index(expr value)
So far, I know that Ellipsis is [...], Slice is the usual [start:end:step] notation, Index is [index], but which notation is ExtSlice?
An extended slice is a slice with multiple parts which uses some slice-specific feature.
A slice specific feature is something like
...(a literal ellipsis) or a:(a test separator).So, an example where
ExtSliceis involved for an expression likeo[...:None]oro[1,2:3].Here are some examples demonstrating this: