3 ms·
Some people may not understand the context of this part: So not long ago someone apparently convinced someone else at a conference that static typing
by pixelmonkey 12y ago
Some people may not understand the context of this part:
So not long ago someone apparently convinced
someone else at a conference that static typing
is awesome and should be a language feature. I'm
not exactly sure how that discussion went but the
end result was that mypy's type module in combination
with Python 3's annotation syntax were declared to be
the gold standard of typing in Python.
Ronacher is referring to the fact that Guido van Rossum, the Python language creator and BDFL, recently said he wanted to make mypy's type annotation standard into a standard by making use of Python 3 function annotations.
The original function annotations standard is PEP-3107[1], GvR's proposal is on the python-ideas list[2], and information on mypy can be found at the project's site[3].
I agree with Ronacher's conclusion; I don't think static types -- even if only used at runtime -- are a good fit for the language. As for function annotation syntax, I think we just need to admit that isn't really good for anything.
Great article!
[1]: http://legacy.python.org/dev/peps/pep-3107/ http://legacy.python.org/dev/peps/pep-3107/
[2]: https://mail.python.org/pipermail/python-ideas/2014-August/028618.html https://mail.python.org/pipermail/python-ideas/2014-August/0...
[3]: http://www.mypy-lang.org/ http://www.mypy-lang.org/
- keypusher 12y agoThe thing that function annotation syntax is good for is the ability to catch errors before they hit your production server at 2AM on a Tuesday. If you can describe the types that a function accepts and returns, violations of those rules can be caught by static analysis such as pylint and let you know before you commit. The current approach in Python after refactoring a large chunk of code is to grep through all the existing callers, fix what you can find, run the tests and hope for the best.