[Python-ideas] Python-ideas Digest, Vol 93, Issue 31

Guido van Rossum guido at python.org
Wed Aug 13 23:09:55 CEST 2014


On Wed, Aug 13, 2014 at 1:18 PM, Raymond Hettinger <
raymond.hettinger at gmail.com> wrote:

>
> On Aug 13, 2014, at 12:44 PM, python-ideas-request at python.org wrote:
>
>  The goal is to make it possible to add
> type checking annotations to 3rd party modules (and even to the stdlib)
> while allowing unaltered execution of the program by the (unmodified)
> Python 3.5 interpreter.
>
>
> Is the goal to "make it possible" or would it quickly become required
> (i.e. any time you write normal, readable Python, it would break
> someone's optimizer, refactorer, linter, etc.?)
>

Whoa, whoa. That's not at all the idea. Currently *nobody* uses type
annotations because there's no standard notation. My goal is to enable
their use by proposing a standard, nothing more.


> Are these annotations going to be pushed into every nook and cranny
> in the standard library and wend their way into the C code?
>

There's no need for that. Mypy lets you create stub modules that shadow
stdlib (and other) modules during typechecking, and it comes with a modest
set of standard stubs for some of the most popular stdlib modules. In most
cases it's actually much more effective to create a stub than to add the
annotations to the stdlib source code -- the stdlib code itself often is
difficult to type check due to various optimizations or backwards
compatibility concerns, but writing stubs is relatively straightforward,
and the stubs will give useful guidance to users of the stdlib who care to
run mypy over their own code.

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


More information about the Python-ideas mailing list