Author gvanrossum
Recipients BvB93, gvanrossum, joshbode, levkivskyi, serhiy.storchaka
Date 2020-09-19.17:12:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600535550.54.0.567883651761.issue41810@roundup.psfhosted.org>
In-reply-to
Content
> 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().
History
Date User Action Args
2020-09-19 17:12:30gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, levkivskyi, BvB93, joshbode
2020-09-19 17:12:30gvanrossumsetmessageid: <1600535550.54.0.567883651761.issue41810@roundup.psfhosted.org>
2020-09-19 17:12:30gvanrossumlinkissue41810 messages
2020-09-19 17:12:30gvanrossumcreate