On Tue, 2021-04-13 at 10:47 +0900, Inada Naoki wrote:
On Tue, Apr 13, 2021 at 9:57 AM Larry Hastings firstname.lastname@example.org wrote:
This is really the heart of the debate over PEP 649 vs PEP 563. If you examine an annotation, and it references an undefined symbol, should that throw an error? There is definitely a contingent of people who say "no, that's inconvenient for us". I think it should raise an error. Again from the Zen: "Special cases aren't special enough to break the rules." Annotations are expressions, and if evaluating an expression fails because of an undefined name, it should raise a NameError.
I agree that this is the heart of the debate. I think "annotations are for type hitns". They are for:
- Static type checkers
+ dynamic type validation, encoding and decoding (Pydantic, FastAPI, Fondat, et al.)