On 02/02/2013 08:48 AM, Schizoid Man wrote: > Also, if the cast is necessary, then now exactly does the dynamic typing > work?
Dynamic typing isn't referring to numeric type coercion. It refers to the fact that a name can be bound to an object of any type. So if you made a function like this: def add (num1, num2): return num1 + num2 num1 and num2 could be any type. Even a custom type if you wanted. This function would work properly on any type that had implemented the __add__ method. And whether or not num2 has to be the same type as num1 depends on whether the num1 type has implemented an __add__ method that can deal with the type of num2. Another case where dynamic typing comes into play is in a case know as duck typing: def squeeze_duck (duck): // return the quack return duck.squeeze() duck can be of any type as well, but as long as it implements the squeeze method, this function will work with an object of that type. In a language like C#, duck-typing can only be emulated by using interface classes. -- http://mail.python.org/mailman/listinfo/python-list