String.join revisited (URGENT for 1.6)
r2d2 at mao.acc.umu.se
Tue May 30 09:33:00 CEST 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.
More information about the Python-list