[issue43535] Make str.join auto-convert inputs to strings.

Gregory P. Smith report at bugs.python.org
Sat Mar 20 18:50:58 EDT 2021


Gregory P. Smith <greg at krypto.org> added the comment:

There is a lot of doubt.  That should clearly raise an exception because this function is intended to only operate on strings.

Trivial types examples like that gloss over the actual problem.

data_from_some_computations = [b"foo", b"bar"]  # probably returned by a function

... later on, some other place in the code ...

colon_sep_data = ":".join(data_from_some_computations)

I guarantee you that 99.999% of the time everyone wants an exception there instead of their colon_sep_data to contain `b"foo":b"bar"`.

Implicit conversions always lead to hard to pin down bugs.  An exception raised at the source of the problem is very easy to debug in comparison.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43535>
_______________________________________


More information about the Python-bugs-list mailing list