This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients JelleZijlstra, barry, eric.smith, gvanrossum, kj, larry, lukasz.langa, methane, xtreak
Date 2021-04-22.11:47:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think it gets a little murkier when we talk about *annotations* vs *type hints*.  Type hints have a defined meaning for a string: a string is a sort of forward declaration, and you eval() the string to get the real value.  (Or, not, if you're comfortable working with the stringized version of the type hint.)  So typing.get_type_hints() calls eval() on *every* annotation value of type str.

But inspect.get_annotations() can't be so opinionated.  If the user entered a string as their annotation, it should assume they want the string to show up in the annotations dict.  This is why I'm trying to be so smart with the "eval_str" default value heuristic.

The text in the docs about a "future version of Python" is pursuant to my vague "PEP 1212" idea, which would let get_annotations() determine or not whether the annotations were stringized by the compiler.  Or whatever we wind up deciding to do for Python 3.11--which, as you say, will hopefully disambiguate this question.

p.s. assuming you meant PEP 563, not PEP 573.
Date User Action Args
2021-04-22 11:47:06larrysetrecipients: + larry, gvanrossum, barry, eric.smith, methane, lukasz.langa, JelleZijlstra, xtreak, kj
2021-04-22 11:47:06larrysetmessageid: <>
2021-04-22 11:47:06larrylinkissue43817 messages
2021-04-22 11:47:06larrycreate