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

Guido van Rossum guido at python.org
Tue Apr 21 22:26:04 CEST 2015


On Tue, Apr 21, 2015 at 1:18 PM, Robert Collins <robertc at robertcollins.net>
wrote:

> On 22 April 2015 at 04:28, Guido van Rossum <guido at python.org> wrote:
> > Until some point in a possible but distant future when we're all thinking
> > back fondly about the argument we're currently having, it will be the
> choice
> > of the author of new (and *only* new) stdlib modules whether and how to
> use
> > type hints. Such a hypothetical author would also be reviewing updates to
> > "their" module and point out lack of type hints just like you might point
> > out an incomplete docstring, an outdated comment, or a missing test. (The
> > type checker would be responsible for pointing out bugs. :-P )
>
> What about major changes to existing modules? I have a backlog of
> intended feature uplifts from testtools into unittest - if the type
> hints thing works out I am likely to put them into testtools. Whats
> your view on type hints to such *new code* in existing modules?
>

In the end this should be up to you and the reviewers, but for such a
venerable module like unittest I'd be hesitant to be an early adopter. I'd
also expect that much of unittest is too dynamic in nature to benefit from
type hints. But maybe you should just try to use them for testtools and see
for yourself how beneficial or cumbersome they are in that particular case?

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


More information about the Python-Dev mailing list