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
0
u/FrontAd9873 Jul 10 '26
By introducing another way to achieve what
typing.Annotatedalready does, this PEP contradicts (to some degree) a few "Zen of Python" guidelines:@that is explicit. Unlike|which already sort of had that meaning.typing.Annotatedthat it makes sense to provide a second, easier way of achieving the same thing? In the case ofUnionI think the answer was clearly "yes."Guidelines are just guidelines. I never claimed that -- as a matter of fact -- Python has only one way to do everything.