gh-119180: PEP 649: Add __annotate__ attributes#119209
Conversation
picnixz
left a comment
There was a problem hiding this comment.
Some comments. I'm wondering whether the error message "annotate returned a non-dict" could be changed to "annotate must return a dict" or "did not return a dict"
For comparison: I think I'll make the |
carljm
left a comment
There was a problem hiding this comment.
Looks good in general, a few comments.
I would prefer to remove the "set __annotate__ to None" behavior; I guess we would have to ask the Steering Council about that. Maybe not worth it unless we see it causing confusion in practice.
This implements https://peps.python.org/pep-0649/#annotate-and-annotations. In separate PRs I will work on making the compiler synthesize
__annotate__functions.