On 18/06/2018 15:03, Steven D'Aprano wrote:

It is 2018. People who say that static typing cannot be integrated with
dynamic languages are nearly half a century behind the state of the art
in computer programming.

It can be, but it spoils the language. In the case of Python, it is already so big and has so many features crammed in that adding type hints probably makes little difference.

I spent a bit of time a decade ago with adding type hints to my own dynamic language. It was done to improve performance, and yes some benchmarks could be double the speed.

In the end I got rid of them to keep the language purer, smaller and simpler. Other approaches which don't involve annotating source code (eg. type inference) are better IMO.

One problem with them was that, if you said X was an int, you were obliged to check it was int, otherwise bad things could happen if it assumed X was int because you said so, and in reality it wasn't. That checking doesn't help improve performance, which was one aim.

--
bart
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to