Why doesn't join() call str() on its arguments?
tjreedy at udel.edu
Thu Feb 17 19:49:31 CET 2005
"Nick Coghlan" <ncoghlan at iinet.net.au> wrote in message
news:421477D4.2050305 at iinet.net.au...
> This seems to be the last relevant message in the thread:
> So it was tried, but we found too many weird corner cases we weren't
> quite sure
> what to do with. At that point, "explicit is better than implicit" kicked
> in :)
> A shame, since it was both faster and more convenient than using a list
> comp. But the convenience wasn't worth the ambiguity of the semantics.
Your experience, where you made an honest go of implementation, and the
error catching argument, convince me that explicit is better for this case.
I was thinking, 'Well, print autoconverts' (as documented). But it
requires that each item be listed. And if there is any ambiguity, no harm
since it is only meant for quick convenience anyway and not exact
char-by-char control. Join, on the other hand, often gets a pre-existing
list. If that is known (thought to be) all strings, then mapping str is a
waste as well as an error mask. In not, map(str,...) is only 9 extra
Terry J. Reedy
More information about the Python-list