Isn't that just typing.get_type_hints()?

On Mon, Jan 11, 2021 at 5:11 PM Greg Ewing <> wrote:
On 12/01/21 6:22 am, Larry Hastings wrote:

  * The language will set __annotations__ to a dict if the object has
>    annotations, or None if it has no annotations.

That sounds inconvenient -- it means that any code referencing
__annotations__ has to guard against the possibility of it being

If we're changing things, I'm wondering if the best thing would be
to introduce an annotations() function as the new best practice for
getting an object's annotations. It would know how to handle all
the type-specific pecularities, and could take care of things such
as manufacturing an empty dict if the object doesn't have any

Python-Dev mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct:

--Guido van Rossum (
Pronouns: he/him (why is my pronoun here?)