Make str.join convert non-str objects implicitly

While I understand the mantra of “Explicit is better than implicit.” in most cases, I wonder what could possibly be a downside to making str conversions implicit for the str.join method.

Wouldn’t this be more intuitive and readable:

' '.join([1, 2, 3])

than the currently accepted boilerplate of mapping items to str first before joining them into a string:

' '.join(map(str, [1, 2, 3]))

I mean, the current code already spends the CPU time to validate that each item is a string, so why not do the helpful thing of converting the item to a string instead of complaining about it, since the intention is always to join the items as a string?

1 Like