On Mar 11, 2005, at 18:18, Raymond Hettinger wrote: > str.join() is still the best practice for string concatenation. ...except you actually need unicode.join if the strings are of that kind. Fortunately, ''.join intrinsically compensates: >>> x=[u'\u0fe0']*2 >>> ''.join(x) u'\u0fe0\u0fe0' *without* (as one would expect) the GD nuisance of converting x's items to str (hellishly hard to document accurately and clearly, but extremely convenient!-). Which reminds me -- could we have a methodcaller relative to attrgetter and itemgetter? "Sort a list of strings in a case-insensitive way" would become *SO* easy with sort(dalist, key=methodcaller('lower'))... can't REALLY recommend sort(dalist, key=str.lower) then the items of dalist MIGHT be either str or unicode items... (the relevance of ''.join is that it proves SOMEbody considered it important to deal with a list of either str or unicode in the joining context... why not in the sorting context then?). Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4