
On 20.11.18 07:12, Michael Lee wrote:
During the typing meetup from a week or two ago, I mentioned that we (the mypy team) were planning on implementing Literal types and would have a draft of the proposed semantics ready soon. Well, here it is: https://github.com/Michael0x2a/peps/blob/literal-types/pep-9999.rst
I still think that we should eventually be able to use plain integers, True, False, and strings as shorthand for literals (in addition to the verbose Literal syntax). typing could be fixed for 3.8, strings are more difficult, but eventually a __future__ import could be introduced that disallows strings for quoting and allows it to be used as literal type. On a more general note, Python's type annotation syntax is quite verbose, often cumbersome to write and hard to read, due to the original requirement of not introducing new syntax. Working towards a more concise shorthand syntax is worthwhile, in my opinion. - Sebastian