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

Guido van Rossum guido at python.org
Tue Apr 21 20:23:57 CEST 2015


On Tue, Apr 21, 2015 at 10:03 AM, Carol Willing <
willingc at willingconsulting.com> wrote:

>
> Two areas of clarification would be helpful for me:
>
> 1. Optional: What does this really mean in practice? Am I opting in to
> static type checking and type hints? Or must I opt out of type hints?
> Having to opt out would probably put more burden on the educational use
> cases than opting in would for a large corporate project.
>

You're definitely opting in. You must do two things to opt in: (a) add type
hints to some of your signatures; (b) run a type checker over your code.
You will only get the benefits of type hints of you do both, and there is
no pressure to opt in. If someone else adds type hints to their code, which
you import, but you don't run the type checker, nothing changes for you
when you run your code (you can still get away with things that happen to
work even the type checker would reject them). When you are reading their
source code, you will see their type hints -- like every other aspect of
writing good code, some people's type hints will be readable, while others'
less so. At least nobody will be writing type hints in Cyrillic. :-)


>
> 2. Clearly, great thought has been put into this PEP. If anyone has a good
> analysis of the potential impact on Python 3 adoption, please do pass
> along. I would be interested in reading the information.
>

I wish I had a crystal ball, but this is hard to predict. Anecdotally, some
people believe this will be catnip, while others believe it to be poison.
The truth will surely be somewhere in the middle. At this point we don't
know what drives Python 3 adoption except time -- it's definitely going up.
:-)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150421/ff84b582/attachment.html>


More information about the Python-Dev mailing list