On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: >> As for Python, my experience with it is that, as >> your application grows, you start getting confused about what the >> argument types are or are supposed to be. > > Whereas people never get confused about the arguments in static typed > languages? > > The only difference is whether the compiler tells you that you've passed > the wrong type, or your unit test tells you that you've passed the wrong > type. What, you don't have unit tests? Then how do you know that the code > does the right thing when passed data of the right type? Adding an extra > couple of unit tests is not that big a burden.
The valid type(s) for an argument can be divided into two categories: Those the compiler can check for, and those the compiler can't check for. Some languages have more in the first category than others, but what compiler can prove that a string is an HTML-special-characters-escaped string? In a very few languages, the compiler can insist that an integer be between 7 and 30, but there'll always be some things you can't demonstrate with a function signature. That said, though, I do like being able to make at least *some* declaration there. It helps catch certain types of error. ChrisA -- http://mail.python.org/mailman/listinfo/python-list