On Mon, Sep 11, 2017 at 3:25 PM, Lukasz Langa <luk...@langa.pl> wrote: [..] > This PEP is proposing delaying evaluation until annotations are accessed but > gives user code the power to decide whether the string form is enough, or > maybe an AST would be enough, or actual evaluation with get_type_hints() or > eval() is necessary.
I'm one of those who used annotations for other purposes than type hints. And even if annotations became strings in Python 3.7 *without future import*, fixing my libraries would be easy -- just add an eval(). That said, the PEP doesn't cover an alternative solution: 1. Add another special attribute to functions: __annotations_text__. 2. __annotations__ becomes a dynamic Mapping, which evaluates stuff from __annotations_text__ *lazily*. 3. Recommend linters and IDEs to support "# pragma: annotations", as a way to say that the Python files follows the new Python 3.7 annotations semantics. That would maintain full backwards compatibility with all existing Python libraries and would not require a future import. Yury _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/