[Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

Stefan Behnel stefan_ml at behnel.de
Mon Sep 11 15:23:21 EDT 2017


Ryan Gonzalez schrieb am 11.09.2017 um 19:16:
> One thing I want to point out: there are a lot of really useful Python
> libraries that have come to rely on annotations being objects, ranging
> from plac to fbuild to many others. I could understand something that
> delays the evaluation of annotations until they are accessed, but this
> seems really extreme.

I guess there could be some helper that would allow you to say "here's an
annotation or a function, here's the corresponding module globals(), please
give me the annotation instances".

But the "__annotations__" mapping could probably also be self-expanding on
first request, if it remembers its globals().

Stefan



More information about the Python-ideas mailing list