[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484

Chris Angelico rosuav at gmail.com
Tue Aug 2 19:11:39 EDT 2016


On Wed, Aug 3, 2016 at 9:07 AM, Guido van Rossum <guido at python.org> wrote:
>> If, as I suspect. upi meant 'a: float' to be a different kind of statement,
>> such as a static type declaration for the name 'a', it would be a major
>> change to Python, unlike adding type hints to existing statements.  It would
>> make the annotation required, not optional.  It would complicate an
>> annotation stripper, as 'a: float' would have to be handled differently from
>> 'a: float = 1.0'.
>
> But there are no annotation strippers, only parsers that understand
> the various annotation syntaxes and ignore the annotations.

Hmm, is that true, or are there 3->2 tools that do that? (Though
they'd just have to be special-cased to remove the entire line.)

ChrisA


More information about the Python-ideas mailing list