PEP 526 - var annotations and the spirit of python

Antoon Pardon antoon.pardon at vub.be
Fri Jul 6 03:42:09 EDT 2018


On 06-07-18 08:17, Steven D'Aprano wrote:
> On Thu, 05 Jul 2018 16:09:52 +0200, Antoon Pardon wrote:
>
>>> This is not an innovation of Mypy. It's how type inference is supposed
>>> to work. If a particular type checker doesn't do that, it is doing it
>>> wrong.
>> That is how type interference works in languages that have some kind of
>> static typing like Haskell.
> No, that's how type inference works in dynamically typed languages like 
> Python as well. See Mypy for an example.

Sorry, but this kind of wording is misleading to me. IMO, it strongly suggests
that we can have type inference in python without losing any of the dynamism.

The impression that I got from this thread was that you could just trow any
python program through mypy and it would work.

> But if you opt-in to using a type-checker, the assumption is that you are 
> writing in a less-dynamic, more-static style that will actually get some 
> advantage from static type checking. If you're not doing so, then you're 
> just annoying yourself and wasting time and you won't enjoy the 
> experience one bit.

Thank you for this clarification. It seems that we are largely agreeing but
I seem to have understood your past contributions differently than you intended.

-- 
Antoon.




More information about the Python-list mailing list