I am heavy -1 on this. In my opinion, it does not solve any existing real problem. Typing Annotated[] on a keyboard is not that hard and letters are free (especially nowadays).
While it creates several real problems:
- It requires to add
__matmul__magic method to most builtin types. For a very niche usecase. It is not something fundamental as|does. - Some existing custom types might already have
@defined to do something different. In this case using them with@would be impossible and would still require usingAnnotateddirectly - It creates complex operator precedence rules
int | str @ Metadataand(int | str) @ Metadataare two different things - It would also require us to either port
Annotatedto C code to use something similar toPy_GenericAliasor to just always call Python code from C code, which is really slow and error-prone
Let’s please do not do this ![]()
However, your PEP work is really impressive and the idea is worth discussing! Thanks a lot for raising this topic.