[Python-ideas] Proposal: Use mypy syntax for function annotations

Guido van Rossum guido at python.org
Thu Aug 14 01:24:43 CEST 2014


On Wed, Aug 13, 2014 at 3:26 PM, Manuel Cerón <ceronman at gmail.com> wrote:

> The type checking algorithm might evolve over the time, but by including
> typing.py in the stdlib, the syntax for annotations would be almost frozen
> and that will be a limitation. In other projects such as TypeScript (
> http://www.typescriptlang.org/), that the syntax usually evolves
> alongside the algorithms.
>

What kind of evolution did TypeScript experience?


> Is the syntax specifyed in typing.py mature enough to put it in the stdlib
> and expect users to start annotating their projects without worrying too
> much about future changes?
>

This is a good question. I do think it is good enough as a starting point
for future evolution. Perhaps the biggest question is how fast will the
annotation syntax need to evolve? If it needs to evolve significantly
faster than Python 3 feature releases come out (every 18 months,
approximately) then it may be better to hold off and aim for inclusion in
the 3.6 standard library. That would allow more time to reach agreement
(though I'm not sure that's a good thing :-), and in the mean time
typing.py could be distributed as a 3rd party module on PyPI.


> Is there enough feedback from users using mypy in their projects?
>
> I think that rushing typing.py into 3.5 is not a good idea. However, It'd
> be nice to add some notes in PEP8, encourage it's use as an external
> library, let some projects and tools (e.g. PyCharm) use it. It's not that
> bad if mypy lives 100% outside the Python distribution for a while. Just
> like TypeScript to JavaScript.
>

Well, JavaScript's evolution is tied up forever in a standards body, so
TypeScript realistically had no choice in the matter. But are there
actually people writing TypeScript? I haven't heard from them yet (people
at Dropbox seem to rather like CoffeeScript). Anyway, the situation isn't
quite the same -- you wouldn't make any friends in the Python world if you
wrote your code in an incompatible dialect that could only be executed
after a translation step, but in the JavaScript world that's how all
alternative languages work (and they even manage to interoperate).


> After getting some user base, part of it (typing.py) could be moved to the
> stdlib.
>

I'm still hopeful that we can get a sufficient user base and agreement on
mypy's features for inclusion in 3.5 (extrapolating the 3.4 release
schedule by 18 months, 3.5 alpha 1 would go out around February 2015; the
feature freeze cut-off date, beta 1, would around May thereafter).

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


More information about the Python-ideas mailing list