◐ Shell
clean mode source ↗

gh-119180: PEP 649: Add __annotate__ attributes by JelleZijlstra · Pull Request #119209 · python/cpython

@JelleZijlstra JelleZijlstra changed the title PEP 649: Add __annotate__ attributes gh-119180: PEP 649: Add __annotate__ attributes

May 20, 2024

picnixz

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

@JelleZijlstra

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:

>>> iter(X())
Traceback (most recent call last):
  File "<python-input-4>", line 1, in <module>
    iter(X())
    ~~~~^^^^^
TypeError: iter() returned non-iterator of type 'int'

I think I'll make the __annotate__ errors similar.

carljm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

estyxx pushed a commit to estyxx/cpython that referenced this pull request

Jul 17, 2024