Python, Typing, and the Scientific Spirit

There's been a minor blog storm over the last few weeks about Guido van Rossum's proposal to add optional type declarations to Python [1]. Guido believes it will help catch errors before code is run (or in sections of code that aren't exercised by unit tests), but other people say no, the extra clutter and complexity will spoil Python's clean lines.

The problem is, neither side has any real data to back up their arguments. Will optional static typing catch 1% of errors? 10%? 50%? 90%? And how cost-effective will it be? If it takes twice as long to write code, but 50% of errors that would otherwise not show up until run-time are caught on load, is that a net win or not?

Four and a half years ago, when Python's developers were arguing over the syntax for multi-list iteration, I ran an experiment to find out how well users would understand some of the proposals. In the same spirit, I'd like to see the advocates and opponents of optional static typing put their heads together and design an experiment to gauge its costs and benefits. I'd be very happy to run that experiment here in Toronto, and I'm sure others would do the same in their user communities. Best case, the results convince all but a few die-hards that it is or isn't worth doing. Worst case, figuring out how to tell if optional static typing is a win or not will clarify the debate, and we'll all have the satisfaction of knowing that we at least tried to be scientific about programming language design.

[1] See these two articles and many follow-ups on the Daily Python URL.

comments powered by Disqus