Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] PEP 526 (variable annotations) accepted provisionally

Guido van Rossumguido at python.org
Wed Sep 7 14:18:34 EDT 2016


I'm accepting PEP 526 provisionally.I am personally confident that this PEP is adding a useful new featureto the language: annotations that can be used by a wide variety oftools, whether off-line type checkers or frameworks that add runtimechecking (e.g. traits or traitlets).The provisional status reflects the understanding that minor detailsof the proposed syntax and its runtime effects may still have tochange based on experience during the 3.6 life cycle. (For example,maybe we end up not liking ClassVar, or maybe we'll decide we'll wantto support `x, y, z: T` after all.)There's been some quite contentious discussion about the PEP, on andoff python-dev, regarding how the mere presence of annotation syntaxin the language will change the way people will see the language. Myown experience using mypy and PyCharm has been quite different:annotations are a valuable addition for large code bases, and it'sworth the effort to add them to large legacy code bases (thinkmillions of lines of Python 2.7 code that needs to move to Python 3 by2020). The effect of this has been that engineers using Python arehappier and more confident that their code works than before, have aneasier time spelunking code they don't know, and are less afraid ofbig refactorings (where conversion to Python 3 can be seen as theultimate refactoring).I should blog about our experience at Dropbox; I hope the Zulip opensource folks (not at Dropbox) will also blog about their experience.In the meantime you can read Daniel F. Moisset's three-part blog aboutadding annotations to pycodestyle (formerly pep8) here:http://www.machinalis.com/blog/a-day-with-mypy-part-1/If you want to see a large open source code base that's annotated formypy (with 97% coverage), I recommend looking at Zulip:https://github.com/zulip/zulipFinally, some of us are starting a new (informational) PEP to setexpectations for how type checkers should make use of the annotationsyntax standardized by PEP 484 and PEP 526. This is going to take moretime, and new collaborators are welcome here:https://github.com/ilevkivskyi/peps/blob/new-pep/pep-0555.txt. (Mark,I really hope you'll accept the invitation to participate. Yourexperience would be most welcome.)-- --Guido van Rossum (python.org/~guido)


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp