3 ms·
You miss out on a nice side-effect of join being a method of string: br = '<br>'.join br((a, b, c)) Personally I think it makes more sense the ruby way but i
by zepolen 18y ago
You miss out on a nice side-effect of join being a method of string:
br = '<br>'.join
br((a, b, c))
Personally I think it makes more sense the ruby way but it's never bugged me.
- rbanffy 18y agoWow... This one is quite pretty. Really. A very nice side effect of the "everything is an object" concept.
- silentbicycle 18y agoThere's not any reason you need objects for that, though. Python's join in the string module is called as join(list [,sep])*, and you could say def br(sl): return string.join(sl, "<br>") or br = lambda sl: string.join(sl, "<br>") for the same effect. It's actually due to first-class functions.