Oct. 27, 2004
8:47 a.m.
However, I'd like some guidance on the best way to case-insensitively sort a Python list in C code to fix (B). The best thing I see would be to expose PyString_Lower/PyUnicode_Lower and/or PyString_Upper/PyUnicode_Upper so they can be used to .lower()/.upper() the given environment mapping keys for sorting.
Why not mimic the pure python approach? lowerfunc = PyObject_GetAttrString(&PyUnicode_Type, "lower"); PyObject_CallMethod(mylist, "sort", "OO", Py_None, lowerfunc); Raymond