[Python-ideas] Add list.join() please

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jan 29 18:38:13 EST 2019


Brendan Barnwell wrote:
>     Personally what I find is perverse is that .join is a method of 
> strings but does NOT call str() on the items to be joined.

Neither do most other string methods:

 >>> s = "hovercraft"
 >>> s.count(42)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly

Why should join() be any different?

-- 
Greg



More information about the Python-ideas mailing list