On Fri, Apr 16, 2021 at 1:51 AM Sebastian Rittau <srittau@rittau.biz> wrote:
I am strongly in favor of diverging type annotation syntax from Python syntax. Currently, type annotations are a very useful tool, but often clunky to use. Enhancements have been made, but design space is limited when working within existing Python syntax. Type annotations have a different set of rules, needs, and constraints than general-purpose Python code. This is similar to other domain specific languages like regular expressions. Ideally, Python itself would not check the syntax of annotations, except as needed for determining the end of an annotation.
Another example is a discussion a little while back on python-ideas about extending what's allowed inside square brackets. It started with a use-case for type specification. It turned out that there were other use cases, more tightly tied to the original meaning of __getitem__. Nevertheless, it struck me at the time that it would be nice if the Typing use case could be addressed without the complication of making something that made sense in two very different domains. - Chris -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython