Oleg Broytmann writes:
On Wed, 14 Mar 2001, Dieter Maurer wrote:
I am not yet clear about a good syntax. It should be something, that pairs the attribute with the sorting function essential for this attribute: something like:
sort="attr1[cmp1],attr2,attr3[cmp3],...."
This should mean, use "cmp1" for "attr1", the default comparison for "attr2" (i.e. cmp) and "cmp3" for "attr3" (and so on).
Each "cmp" is looked up in the namespace and if not found there, in a standard set of comparison function, such that it is easy to get "locale_asc", "locale_desc", "case_insensitive_asc", ....
As I already said, this looks good... but I don't want to have a predefined set of names. Sad, because it would be difficult for non-Python programmers to define these functions.
What I suggest is an approach similar to the custom formats: there is a predefined set of well known and often used sort function (such as "locale", "case_insensitive", ...) *BUT* a user can use a function of his own, too, if he likes.
I want these "locale_asc"/"locale_desc" to be the real functions. And I don't want to have 2 almost identical functions (asc/desc) for every comparison function. So I am thinking about syntax like this:
sort="attr1/cmp1,attr2,attr3/cmp3/desc,...." To separate the direction is a good idea. I like it. I am not so sure about the '/' separators. I expect, we will soon get "/" separated object access paths. Then, the use of "/" for a completely different purpose may be confusing. Not sure, that my "[...]" is better in this respect...
Dieter