Numpy, for example, allows multi-dimensional slices:

```
a[:, 0, 7:9]

```

This raises the question: what else is possible? (Imagine the possibilities!)

According to [this answer](https://stackoverflow.com/a/1685450/1143274) and some experimentation (see below), if there is a comma, Python builds a tuple of objects, some of which may be slice objects, and passes it (as `key`) to `__getitem__(self, key)` of `a`.

The [documentation for `__getitem__(..)`](https://docs.python.org/3/reference/datamodel.html#object.__getitem__) doesn't specify this behaviour. Is there any official documentation that I missed? In particular, how backwards-compatible is this syntax? (Searching the web for "python extended slice notation" gives ["What's new in Python 2.3"](https://docs.python.org/2.3/whatsnew/section-slices.html), which doesn't mention it.)

---

Experimentation
---------------

```
>>> class Test(object):
...     def __getitem__(self, x):
...         print repr(x)

>>> t = Test()

```

First, things that Python finds recognisable for multi-slicing:

```
>>> t[1]
1

>>> t['a':,]
(slice('a', None, None),)

>>> t['a':7:('b','c'),]
(slice('a', 7, ('b', 'c')),)

# Seems like it can be arbitrary objects?
>>> t[(t,t):[4,5]]
slice((<__main__.Test object at 0x07D04950>, <__main__.Test object at 0x07D04950>), [4, 5], None)

>>> t[::]
slice(None, None, None)

>>> t[:]
slice(None, None, None)

>>> t[::,1,::,::,:,:,:]
(slice(None, None, None), 1, slice(None, None, None), slice(None, None, None), slice(None, None, None),  slice(None, None, None), slice(None, None, None))

>>> t[...]
Ellipsis

>>> t[... , ...]
(Ellipsis, Ellipsis)

>>> t[  .   .      .    ]
Ellipsis

```

Some things that are NOT allowed (SyntaxError):

```
# Semicolon delimiter
t['a':5; 'b':7:-7]
# Slice within a slice
t['a':7:(9:5),]
# Two trailing commas
t[5,,]
# Isolated comma
t[,]
# Leading comma
t[,5]
# Empty string
t[]
# Triple colon
t[:::]
# Ellipses as part of a slice
t[1:...]
t[1:2:...]
# Ellipses inside no-op parens:
t[(...)]
# Any non-zero and non-three number of dots:
t[.]
t[..]
t[ .  .  .  . ]

```