
July 2, 2017
11:38 a.m.
On Sun, Jul 2, 2017 at 9:16 PM, Steven D'Aprano <steve@pearwood.info> wrote:
If we want to support that optimization, we could add an optimization flag that strips annotations at runtime, just as the -OO flag strips docstrings. That becomes a matter of *consenting adults* -- if you don't want annotations, you don't need to keep them, but it then becomes your responsibility that you don't try to use them. (If you do, you'll get a runtime AttributeError.)
IMO people should act as if this will eventually be the case. Annotations should be evaluated solely for the purpose of populating __annotations__, and not for any sort of side effects - just like with assertions. ChrisA