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

David Eppstein eppstein at ics.uci.edu
Wed Feb 16 17:24:54 EST 2005


In article <37hippF4gcimiU1 at individual.net>,
 Leo Breebaart <leo at lspace.org> wrote:

> What I can't find an explanation for is why str.join() doesn't
> automatically call str() on its arguments, so that e.g.
> str.join([1,2,4,5]) would yield "1245", and ditto for e.g.
> user-defined classes that have a __str__() defined.

That would be the wrong thing to do when the arguments are unicodes.

-- 
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list