r/FastAPI • u/darwinian_demon • Jul 10 '26
feedback request PEP 835: A native shorthand for Annotated
Ivan Levkivskyi and I are proposing a native shorthand for Annotated (PEP 835) to clean up heavy type-hinting patterns. We have confirmed this syntax is fully compatible with FastAPI and works out of the box with zero changes required.
Before:
...
After:
...
The Spec: PEP 835 Full Draft
We are gathering community sentiment before moving forward. If you are a heavy user of Annotated in FastAPI, your feedback is valuable. You can register your stance in the official Discourse poll before it closes on July 15.
32
Upvotes
View all comments
Show parent comment
4
u/MyNameIsBeaky Jul 10 '26
You can make the point that @ is not explicit or as natural of a fit as | was to replace Union, but I truly believe Annotated deserves a less verbose native replacement and this type of language improvement is very much in line with historical python evolution.