[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484
Guido van Rossum
guido at python.org
Tue Aug 2 19:15:06 EDT 2016
On Tue, Aug 2, 2016 at 4:11 PM, Chris Angelico <rosuav at gmail.com> wrote:
> 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.)
We had one in mypy that pretended to be a codec, but it was a disaster
so I consider it a failed concept.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list