...

This post first appeared 23 April 2023.

The following is valid python code:

def some_function():
   ...

That’s not a placeholder, that’s a constant called Ellipsis:

>>> ...
Ellipsis
>>> Ellipsis
Ellipsis
>>> ... is Ellipsis
True

The result is that the function some_function runs, it just returns nothing (since the only expression evaluates a constant and does nothing with it). Its like the todo! in rust except it doesn’t crash.

So what’s the point? Well just to name a few, docs where you don’t want to fill in the function body, type hints like Tuple[int, ...], natural array indexing, and making doctests less verbose.

It’s a small thing, but neat…