Tim Chase wrote: > The interpreter is clearly smart enough to recognize when the > condition occurs such that it can throw the error...thus, why not > add a few more smarts and have it simply translate it into > "start+''.join(sequence)" to maintain predictable behavior > according to duck-typing?
"join" doesn't use __add__ at all, so I'm not sure in what sense that would be more predictable. I'm probably missing something, but I cannot think of any core method that uses a radically different algorithm based on the *type* of one argument. besides, in all dictionaries I've consulted, the word "sum" means "adding numbers". are you sure it wouldn't be more predictable if "sum" converted strings to numbers ? (after all, questions about type errors like "cannot concatenate 'str' and 'int' objects" and "unsupported operand type(s) for +: 'int' and 'str'" are a *lot* more common than questions about sum() on string lists.) </F> -- http://mail.python.org/mailman/listinfo/python-list