
Hi all, I was wondering what our plan was to allow use of Literal types to make more expressive stubs for the standard library. Now that PEP 586 is accepted, is it time for us to update the stubs for open, etc.? Best, Mark Mendoza

Yes, we should accept Literal (and other new features) as soon as enough type checkers support it, or at least are able to deal with stubs using the new feature. if pytype and PyCharm are OK with Literal, we should be able to use it. El jue., 13 jun. 2019 a las 15:07, Guido van Rossum (<guido@python.org>) escribió:

pytype doesn't support Literal yet, but we added a `def __getattr__(name) -> Any` stub for typing_extensions ( https://github.com/google/pytype/blob/master/pytype/pytd/builtins/2and3/typi...), so it should be possible to annotate things with Literal without pytype complaining. Given that the PEP has been accepted, I agree that it seems reasonable to start using it. Rebecca On Thu, Jun 13, 2019 at 3:10 PM Jelle Zijlstra <jelle.zijlstra@gmail.com> wrote:

Am 14.06.19 um 00:09 schrieb Jelle Zijlstra:
+1 From what I understand, mypy, pytype, and pyre can at least deal with it in stubs. I just checked PyCharm. While I don't think it supports literals, yet, it seems to cope with them. So if nobody objects, I am going to close #2931 (https://github.com/python/typeshed/issues/2913) and we can start accepting Literals. - Sebastian

Yes, we should accept Literal (and other new features) as soon as enough type checkers support it, or at least are able to deal with stubs using the new feature. if pytype and PyCharm are OK with Literal, we should be able to use it. El jue., 13 jun. 2019 a las 15:07, Guido van Rossum (<guido@python.org>) escribió:

pytype doesn't support Literal yet, but we added a `def __getattr__(name) -> Any` stub for typing_extensions ( https://github.com/google/pytype/blob/master/pytype/pytd/builtins/2and3/typi...), so it should be possible to annotate things with Literal without pytype complaining. Given that the PEP has been accepted, I agree that it seems reasonable to start using it. Rebecca On Thu, Jun 13, 2019 at 3:10 PM Jelle Zijlstra <jelle.zijlstra@gmail.com> wrote:

Am 14.06.19 um 00:09 schrieb Jelle Zijlstra:
+1 From what I understand, mypy, pytype, and pyre can at least deal with it in stubs. I just checked PyCharm. While I don't think it supports literals, yet, it seems to cope with them. So if nobody objects, I am going to close #2931 (https://github.com/python/typeshed/issues/2913) and we can start accepting Literals. - Sebastian
participants (6)
-
Guido van Rossum
-
Jelle Zijlstra
-
Mark Mendoza
-
Rebecca Chen
-
Sebastian Rittau
-
Teddy Sudol