String.join revisited (URGENT for 1.6)

Niklas Frykholm r2d2 at
Tue May 30 03:33:00 EDT 2000

Greg Ewing wrote:
>Personally, I don't think that such a generalised join belongs
>as a method of *either* argument.

>I think that a suitably generalised join should be a builtin, 
>like map and reduce.

I can't see a generalised join being used often enough to warrant
making it a built-in. Whenever you need a generalised join, you
can simply write:

    reduce(lambda x,y: x+" "+y, list)

(Use desired operation in place of x + " " + y.)

Since you will be using __add__ operations anyway (in the
generalised case) I don't think there would be any great
speed improvements by having the generalised join as a built-in.

// Niklas

More information about the Python-list mailing list