[Python-Dev] adding Py{String|Unicode}_{Lower|Upper} and fixing
CreateProcess in _subprocess.pyd and PyWin32
Raymond Hettinger
python at rcn.com
Wed Oct 27 10:47:36 CEST 2004
> 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
More information about the Python-Dev
mailing list