It's the Ellipsis, it has many meanings and none at all. Let me explain;
It's an 'empty' singleton object with no method and its interpretation is purely up to whatever implements the __getitem__
function and sees Ellipsis objects there.
- It can be used as a substitute for
pass
or not yet implemented code;
def my_function(arg):
...
- It is used to denote certain types to a static type checker when using the typing module (for type hints).
def partial(func: Callable[..., str], *args) -> Callable[..., str]:
# code
- In slice syntax to represent the full slice in remaining dimensions;
import numpy as np
>>>
>>> array = np.random.rand(2, 2, 2, 2)
>>> print(array[..., 0])
[[[0.03265588 0.85912865]
[0.45491733 0.3654667 ]]
[[0.58577745 0.11642329]
[0.88552571 0.69755581]]]
Thank you so much for this question, I learned something new in Python today.