'''Wikipedia''' [http://wikipedia.org/] is an ambitious attempt to collect much of the world's wisdom in a Wiki. ---- [AMG]: I just noticed that the Wikipedia page on Duck Typing [http://en.wikipedia.org/wiki/Duck_typing] completely fails to mention Tcl. This needs to change, seeing as how Tcl pretty much wrote the book on duck typing. [PYK] 2014-05-28: I sorta thought [Python] wrote the book on duck typing. I think expanding the presence of [Tcl] on Wikipedia is a very useful activity, and hope someone finds the time to expand the duck typing article there. [AMG]: Not at all. In Python, types are intrinsic in values, whereas in Tcl, types exist only within the program's interpretation of values. Python sees `"2"`, `2`, and `(2,)` as distinct, and they cannot be +'ed (added or concatenated) without the programmer explicitly begging that one be converted from str to int, or vice versa, plus don't forget about unpacking single-element tuples or lists. Tcl sees no distinction between the three (though it renders the single-element tuple `(2,)` as `{2}` or simply `2`). The determination between adding or concatenation is made not by the inherent type (a concept foreign to Tcl), but rather by having adding and concatenation being separate operations. With Tcl, the type is inferred according to the operations being performed on the value, and the type can freely change from moment to moment with no need for explicit conversions. The interpreter figures out the type based on what the programmer is trying to do. ====== set operands {"2" 2 {2}} tcl::mathop::+ {*}$operands ;# 6 join $operands {} ;# 222 list {*}$operands ;# 2 2 2 ====== With Python, the type is explicitly declared according to how the value was constructed. Surround it in quotes, and it's a string. Put it in brackets, and it's a mutable list. Put it in parentheses with commas, and it's an immutable tuple. Put it in braces, and it's a dict. And so forth. Conversions are not automatic, and the programmer has to explicitly ask for them. ======none operands = ("2", 2, (2,)) def collapse(x): while isinstance(x, (list, tuple)): x = x[0] return x reduce(lambda x, y: x + y, operands) # cannot concatenate 'str' and 'int' objects reduce(lambda x, y: int(collapse(x)) + int(collapse(y)), operands, 0) # 6 reduce(lambda x, y: str(collapse(x)) + str(collapse(y)), operands, "") # '222' reduce(lambda x, y: x + (int(collapse(y)),), operands, ()) # (2, 2, 2) reduce(lambda x, y: x + (str(collapse(y)),), operands, ()) # ('2', '2', '2') ====== [PYK] OK, I see where you're coming from now , and how the concept of duck typing could be applied to Tcl values , but Tcl's [EIAS] wonderfulness isn't what Python programmers have in mind at all by "duck typing" . They are primarily thinking about the interfaces of the objects they pass around , and the fact that clients of those objects need not inspect the type of the object , but instead can inspect the interface (method) in order to decide whether or not to work with them . I still think it would be great for the Wikipedia article to have an section about Tcl , perhaps with the title "And now for someting completely different ..." ;) <> Internet