Guido van Rossum <gu...@python.org> added the comment:

> Would not be better to make MyPy supporting type(Ellipsis)? It would work 
> also on Python versions older than 3.10.

That would be quite complicated. There is no place in annotations where a 
function call is currently supported, so I'd prefer not to go there.

> Also, could not Literal[Ellipsis] be used as annotation?

Alas, it currently doesn't work (PEP 586 only allows specific types, and type 
checkers have implemented it exactly). Making it work would be more complicated 
than the proposal -- once it exists in types.py, it's trivial to add support to 
mypy.

IMO ideally, eventually, all "hidden" built-in types ought to be exposed 
somewhere, unless they are truly implementation details -- but since Ellipsis 
is a first-class singleton object, I don't see how its type could be an 
implementation detail. (Its name is actually clearly visible  in 
repr(type(Ellipsis)).)

Note that we have started exporting the types of other constructs through 
types.py, e.g. type(int|str) is types.Union, and type(list[str]) is 
types.GenericAlias. This is revealed in their repr().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41810>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to