-
Website
http://osteele.com -
Original page
http://osteele.com/archives/2005/01/three-lefts -
Subscribe
All Comments -
Community
-
Top Commenters
-
llimllib
1 comment · 2 points
-
sbecker
1 comment · 1 points
-
mattherdy
1 comment · 1 points
-
ultrasaurus
1 comment · 1 points
-
Facebook User
2 comments · 1 points
-
-
Popular Threads
I was just reading the latest brain dump by Guido on 'Optional Static Typing in Python' and various comments on it.
First impression? I don't like it. The simple reason being that it makes Python much more complex. I know its the same rant again ...
Of the approaches you present exactly one will definitely prevent the function body being executedwith ill-typed arguments by any client code: assertions.
Variable names, comments and structured comments will not provent client code asking for gcd(-7.62, 2+i), but they will prompt any human who's read the declaration of gcd to not casually write code that would do that, which seems like a win. This is the way programmers in languages with dynamic typing get used to thinking.
Of your proposed aproaches exactly one tells the human programmer and the client code a direct lie about gcd(): type declaration. It does not merely "[lose] the information that a and b are non-negative", it asserts the untruth that they can be negative. How is this any sort of benefit?