On Thu, Sep 8, 2016 at 8:00 AM, Paul Moore <p.f.mo...@gmail.com> wrote:
>
>> Type annotations are code, not tests.
>
> Not in Python they aren't.
>

The interpreter certainly thinks they're code rather than comments or
docstrings, even before PEP 526. I type this into my Python 3.4
interpreter:

>>> def foo(x:itn):
>>> ... return x

and the interpreter raises a NameError because 'itn' is not defined.

Annotations look like code, they're mixed in with names and operators
and literals and keywords, and all the standard syntax and semantic
checks are applied.

-- 

        cheers,
        Hugh Fisher
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to