[Python-ideas] Optional static typing -- the crossroads

Gregory P. Smith greg at krypto.org
Fri Aug 15 18:24:09 CEST 2014


On Thu Aug 14 2014 at 9:47:45 PM Guido van Rossum <guido at python.org> wrote:

> On Thu, Aug 14, 2014 at 9:40 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
>> On 15 August 2014 09:56, Guido van Rossum <guido at python.org> wrote:
>> >
>> > I don't buy the argument that PEP 3107 promises that annotations are
>> > completely free of inherent semantics.
>>
>> It's also worth noting the corresponding bullet point in PEP 3100
>> (under http://www.python.org/dev/peps/pep-3100/#core-language):
>>
>> * Add optional declarations for static typing [45] [10] [done]
>>
>> [10] Guido's blog ("Python Optional Typechecking Redux")
>> http://www.artima.com/weblogs/viewpost.jsp?thread=89161
>> [45] PEP 3107 (Function Annotations)
>> http://www.python.org/dev/peps/pep-3107
>>
>
> Such youthful optimism. :-)
>
>
>> Having Argument Clinic generate appropriate annotations automatically
>> could also be interesting.
>>
>
> How much of the 3.5 stdlib is currently covered by Argument Clinic? I
> thought there's still a lot left to do. Might it be possible to convert
> some of pytypedecl's stubs into AC stubs? Alternatively, the AC info could
> be turned into mypy stubs. I'm just really hoping that between AC,
> pytypedecl, PyCharm and mypy we have specs for most builtins and extension
> modules in machine-readable form already, and we could use this combined
> information to bootstrap mypy's collection of stubs.
>
>
I believe we have partially intersecting subsets of builtins and stdlib
coverage, union them all together and sanity check them and it's a good
start but will likely still have giant holes to be filled in.

We've been concentrating on 2.7 with the code analysis to generate
pytypedecl pytd's for but have always assumed that argument clinic would be
useful in providing annotation details for 3.4 onwards. Should it generate
annotation files itself? possibly, but I'm not sure it is expressive enough
to generate an ideal annotation.

To start with I'd leave generating annotations Python builtins, extensions
and internals itself out of CPython itself in 3.5.

Such things can be pulled in with tools to generate them in later release
once we're happy it is easy to maintain via the tools without a much human
tweaking being required.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140815/6b66e29b/attachment.html>


More information about the Python-ideas mailing list