Given all the effort that get_type_hints() puts into evaluating those strings it seems important to spell out explicitly that they're not special. (IIRC they *are* special in PEP 563.) On Tue, Jan 12, 2021 at 8:56 AM Larry Hastings <larry@hastings.org> wrote:
Yes, PEP 649 is completely agnostic about what values you put in as annotations. You can put in strings, complex objects, expressions--whatever you put in, you get back out later.
I'm happy to add some text to the PEP if this needs clarifying; I just thought it was obvious.
Cheers,
*/arry* On 1/11/21 9:11 PM, Guido van Rossum wrote:
Another thought about this PEP (hopefully my last one tonight).
The section on backwards compatibility doesn't mention what should happen with annotations that are stringified by the user (as is needed for forward references in code that hasn't been PEP-563-ified yet).
That's a PEP 484 feature. Should we start deprecating that at the same time? Static checkers support it but don't need it (for example, stubs in typeshed don't use it since their code is never evaluated).
At the very least I think your PEP should mention what happens for these -- presumably `__annotations__` will just contain the string literal, so get_type_hints() would be needed to evaluate these.
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>