|
|
Subscribe / Log in / New account

When and how to evaluate Python annotations

When and how to evaluate Python annotations

Posted Jun 17, 2021 4:36 UTC (Thu) by jamesh (guest, #1159)
In reply to: When and how to evaluate Python annotations by timrichardson
Parent article: When and how to evaluate Python annotations

From a quick look at the docs, pydantic is treating annotations as types: the same as static type checkers. The same seems to go for attrs. So they don't seem to be examples of using annotations for non-typing purposes.


to post comments

When and how to evaluate Python annotations

Posted Nov 28, 2022 17:06 UTC (Mon) by agarbanzo (guest, #162411) [Link]

I think there's a lot of use cases stemming from PEP 593: https://peps.python.org/pep-0593/. It provides a way to attach arbitrary metadata which is ignored by static type checkers. So pretty much by definition any use of PEP 593 is going to be non-typing related. The PEP even gives an example use case: https://peps.python.org/pep-0593/#combining-runtime-and-s...


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds