[Python-ideas] Delay evaluation of annotations

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Sep 22 16:37:58 EDT 2016


On Thu, Sep 22, 2016 at 4:29 PM, אלעזר <elazarg at gmail.com> wrote:

> Just as a demonstration, the parser can transform `EXP` into `lambda: EXP`
> - and that's it. It will not solve everything (e.g. error messages and
> .__annotation__ access as Alexander says), but it demonstrates the fact
> that the change need not be so deep at all.


On the second thought, why can't the parser a simply replace A with 'A' in
annotations that appear in the body of class A?  This will only break
somewhat pathological code that defines A before it is (re)defined by the
class statement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160922/88f3adb5/attachment.html>


More information about the Python-ideas mailing list