Chris Withers <chrisw@nipltd.com> wrote:
Andy McKay wrote:
They want information fast and most users expect case insensitive sorts. Its simpler and easy. I think having the ignore_case option for a -tree and -in helps Zope by increasing the ease of development and friendliness to the user.
And my point was that this is so universally true that the _pthyon_ sort function (which is at fault here) should be fixed :-)
Python's sort already allows you to pass an alternate comparison function:: [/var/home/tres] $ python Python 1.5.2 (#1, Feb 1 2000, 16:32:16) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
foo = [ 'z', 'y', 'x' ] foo.sort() foo ['x', 'y', 'z'] foo.sort( lambda x, y: cmp(y,x) ) foo ['z', 'y', 'x']
I believe Andy's patch makes use of this feature. You are missing a couple of points if you *require* a case-insensitive sort: * collation (which letters belong together) is highly locale sensitive (e.g., does a-accent-grave sort with a? etc.) * Should strings which differ only in case be equal (*NOT*!) Tres. -- =============================================================== Tres Seaver tseaver@digicool.com Digital Creations "Zope Dealers" http://www.zope.org
* collation (which letters belong together) is highly locale sensitive (e.g., does a-accent-grave sort with a? etc.)
A Fair point. The answer is whatever seems _naturally_ correct from a users point of view. I think the answer is yes. Elephant entropy écrit élan i.e. In the order in which they would appear in a dictionary.
* Should strings which differ only in case be equal (*NOT*!)
'Ant' is not equal to 'ant' but 'Ant'<'ant'<'Ante'<'ante' i.e. Ant ant Ante ante Would be a sensible sort order. I hope that makes things a bit clearer. -Andy
participants (2)
-
Andy Dawkins -
Tres Seaver