Toby Dickenson wrote:
> >(reasons of course would be helpful, particularly if you want it to stay
> >like it is ;-)
> I noticed the smiley, so Im not sure how serious the suggestion is.

It was serious, the smiley was 'cos I couldn't understand why anyone
would want it to stay like it is :-)

> 1. Python doesnt distinguish between 8-bit-strings and byte arrays.
> (for example, ZODB uses 8-byte-long 'strings' as oids). Do you want a
> casewise sort for byte arrays too?

I don't know. Show me why this is bad :-)

> 2. 'sort' uses 'cmp'; so effectively you are asking for string's cmp
> to be case insensitve. Can you demonstrate a case-sensitive collation
> function that is as simple as your case-insensitive one:
> >def _default_sort(x,y):
> >    return cmp(string.lower(x),string.lower(y))

I see your point. I guess cmp is implemented in C?
How about a third optional argument?

def _case_sensitive_sort(x,y):
    return cmp(x,y,string.CASE_SENSITIVE)

def _default_sort(x,y):
    return cmp(x,y)

> 3. ZCatalog stores objects in a pre-sorted order. Changing the sort
> order of any object (not just strings) would break *all* existing
> ZCatalog instances that store mixed case strings. (and other
> applications too - the python language reference documents that this
> assmption is safe at least until python3k)

Sorry, don't qutie follow this... explanation for a simpleton? ;-)



Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to