In article <2mr80du5br.fsf at starship.python.net>, Michael Hudson <mwh at python.net> wrote: > David Eppstein <eppstein at ics.uci.edu> writes: > > > Ok, it sounds like I am stuck with PyObjC's > > NSString.localizedCaseInsensitiveCompare_, since Python's built-in > > cmp(unicode,unicode) sucks and locale doesn't provide an alternative. > > "sucks" is too strong. Maybe there should be better collation support > but I don't think we should change the default comparison to do it. Let me be more specific. Since we have such useful hashing-based dictionary data structures in Python, we don't often need cmp for binary search trees, so the main reason for comparing unicodes (as far as I can tell) is to put them in a logical order for displaying to humans. cmp(unicode,unicode) does a very bad job of this, whenever there are non-ascii characters involved. Its existence tricks you into thinking Python has a useful unicode comparison function when it doesn't. -- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
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