Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

Ellipsis / ...

The three-dot literal denotes the singleton Ellipsis, which can be recognized by identity.

Version: Python 3.14; repository image, production runtime not attested

Syntax

value = ...

The three-dot literal denotes the singleton Ellipsis, which can be recognized by identity.

Ellipsis / ...

In a subscript the receiver decides its meaning. A normal list does not accept it. A bare ... in a function body is an expression with no effect and does not signal an unimplemented function.

Axes maps the middle Ellipsis to rest, and unfinished falls through to None.

import types
assert type(...) is types.EllipsisType and ... is Ellipsis
try: [1,2][Ellipsis]
except TypeError: pass
else: raise AssertionError

Examples

class Axes:
    def __getitem__(self, key):
        return tuple("rest" if part is Ellipsis else part for part in key)

print(... is Ellipsis, Axes()[1, ..., 3])
def unfinished():
    ...
print(unfinished())

Result

True (1, 'rest', 3)
None

Axes maps the middle Ellipsis to rest, and unfinished falls through to None.

Sources