"Strong typing vs. strong testing"
pc at p-cos.net
Thu Sep 30 11:27:48 CEST 2010
On 30/09/2010 08:09, TheFlyingDutchman wrote:
>> That argument can be made for dynamic language as well. If you write in
>> dynamic language (e.g. python):
>> def maximum(a, b):
>> return a if a> b else b
>> The dynamic language's version of maximum() function is 100% correct --
>> if you passed an uncomparable object, instead of a number, your call of
>> it is incorrect; you just didn't pass the right sort of data. And that's
>> your problem as a caller.
>> In fact, since Python's integer is infinite precision (only bounded by
>> available memory); in practice, Python's version of maximum() has less
>> chance of producing erroneous result.
> "in C I can have a function maximum(int a, int b) that will always
> work. Never blow up, and never give an invalid answer. "
> Dynamic typed languages like Python fail in this case on "Never blows
They don't "blow up". They may throw an exception, on which you can act.
You make it sound like a core dump, which it isn't.
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
More information about the Python-list