<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 11, 2017, at 3:23 PM, Stefan Behnel <<a href="mailto:stefan_ml@behnel.de" class="">stefan_ml@behnel.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Ryan Gonzalez schrieb am 11.09.2017 um 19:16:<br class=""><blockquote type="cite" class="">One thing I want to point out: there are a lot of really useful Python<br class="">libraries that have come to rely on annotations being objects, ranging<br class="">from plac to fbuild to many others. I could understand something that<br class="">delays the evaluation of annotations until they are accessed, but this<br class="">seems really extreme.<br class=""></blockquote><br class="">I guess there could be some helper that would allow you to say "here's an<br class="">annotation or a function, here's the corresponding module globals(), please<br class="">give me the annotation instances".<br class=""></div></div></blockquote><div><br class=""></div><div>Currently the PEP simply proposes using <font face="Courier New" class="">eval(ann, globals, locals)</font> and even suggests where to take globals from.</div><div><br class=""></div><div>The problem is with nested classes or type annotations that are using local state. The PEP is proposing to disallow those due to the trickiness of getting the global and local state right in those situations. Instead, you'd use qualified names for class-level fields that you're using in your annotation. This change is fine for static use and runtime use, except when faced with metaclasses or class decorators which resolve the annotations of a class in question.</div><div><br class=""></div><div>So far it looks like both typing.NamedTuple and the proposed data classes are fine with this. But if you have examples of metaclasses or class decorators which would break, let me know!</div><div><br class=""></div><div>- Ł</div></div></body></html>