Why doesn't join() call str() on its arguments?

Max M maxm at mxm.dk
Thu Feb 17 04:49:16 EST 2005


Nick Craig-Wood wrote:
> Nick Vargish <nav+posts at bandersnatch.org> wrote:

> Why not have another method to do this?  I propose joinany which will
> join any type of object together, not just strings

 >>> l = [1,2,3,'four']
 >>> ','.join(map(str, l))
'1,2,3,four'

Is this really that hard to do, that you want it in the library?

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the Python-list mailing list