[Python-Dev] Type hints -- a mediocre programmer's reaction

Cory Benfield cory at lukasa.co.uk
Wed Apr 22 13:09:25 CEST 2015


On 21 April 2015 at 17:59, Guido van Rossum <guido at python.org> wrote:
> For me, PEP 484 is a stepping stone. Among the authors of PEP 484 there was
> much discussion about duck typing, and mypy even has some limited support
> for duck typing (I think you can still find it by searching the mypy code
> for "protocol"). But we ran out of time getting all the details written up
> and agreed upon, so we decided to punt -- for now. But duck typing still
> needs to have a way to talk about things like "seek method with this type
> signature" (something like `def seek(self, offset: int, whence:
> int=SEEK_SET) -> int`) so the current proposal gets us part of the way
> there.
>
> The hope is that once 3.5 is out (with PEP 484's typing.py included
> *provisional* mode) we can start working on the duck typing specification.
> The alternative would have been to wait until 3.6, but we didn't think that
> there would be much of an advantage to postponing the more basic type
> hinting syntax (it would be like refusing to include "import" until you've
> sorted out packages). During the run of 3.5 we'll hopefully get feedback on
> where duck typing is most needed and how to specify it -- valuable input
> that would be much harder to obtain of *no* part of the type hints notation
> were standardized.

This makes a lot of sense.

If PEP 484 is intended to be a stepping stone (or compromise, or beta,
or whatever word one wants to use), then it is easy to forgive it its
limitations, and I'm looking forward to seeing it improve.


More information about the Python-Dev mailing list