Leo Breebaart wrote:
What I can't find an explanation for is why str.join() doesn't automatically call str() on its arguments [...]
[...] Presumably there is some counter-argument involved, some reason why people preferred the existing semantics after all. But for the life of me I can't think what that counter-argument might be...
One possibility I can think of would be Unicode. I don't think that implicitly calling str() on Unicode strings is desirable. (But then again, I know embarrassingly little about unicode, so this may or may not be a valid concern.)
Of course, one could ensure that unicode.join() used unicode() and str.join() used str(), but I can conceive of the possibility of wanting to use a plain-string separator to join a list that might include unicode strings. Whether this is a realistic use-case is, of course, a completely different question...
Jeff Shannon Technician/Programmer Credit International
-- http://mail.python.org/mailman/listinfo/python-list