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

Roy Smith roy at panix.com
Wed Feb 16 19:26:46 EST 2005


In article <eppstein-211DEC.14245416022005 at news.service.uci.edu>,
 David Eppstein <eppstein at ics.uci.edu> wrote:

> 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.

Why would it be wrong?  I ask this with honest naivete, being quite 
ignorant of unicode issues.



More information about the Python-list mailing list