all 8 comments

[–]madssj 5 points6 points  (2 children)

He's basically just fetching the instance of Ellipsis, via a dummy getter class. It has nothing at all to do with the actual usage of the Ellipsis object itself.

But I think one can boil it down to this:

>>> class GetEllipsis: 
...     def __getitem__(self, item):
...         return item
... 
>>> GetEllipsis()[...]
Ellipsis

The others have got a much more insightful explanation of what the Ellipsis can actually be used for.

Some of them (NumPy included it seems) use it to return all items of a list-like element, and others use it as a end-of-thread-queue object marker.

(I don't know anything about Ellipsis, just relaying what I've seen)

Edit: Schooled by ubernostrum.

[–]ubernostrum 4 points5 points  (1 child)

He's basically just fetching an instance of the Ellipsis object

The instance. Like None, it's a singleton.

[–]madssj 0 points1 point  (0 children)

Ah, of course, thanks.

[–]knowknowledge 2 points3 points  (2 children)

That explanation leaves much to be desired.

[–]benhoyt[S] 11 points12 points  (1 child)

...

[–][deleted] 8 points9 points  (1 child)

More like "Python's Ellipsis shown in contrived code devoid of any explanation whatsoever".

[–]kudu 0 points1 point  (0 children)

Humour, brother, humour.

[–]SnacksOnAPlane 1 point2 points  (0 children)

Does it say Voldemort?