Alphabetical sorts

Neil Cerutti horpner at yahoo.com
Tue Oct 17 07:52:41 EDT 2006


On 2006-10-17, Ron Adam <rrr at ronadam.com> wrote:
> Neil Cerutti wrote:
>> On 2006-10-16, Ron Adam <rrr at ronadam.com> wrote:
>>> I have several applications where I want to sort lists in
>>> alphabetical order. Most examples of sorting usually sort on
>>> the ord() order of the character set as an approximation.
>>> But that is not always what you want.
>> 
>> Check out strxfrm in the locale module.
>
> It looks to me this would be a good candidate for a
> configurable class. Something preferably in the string module
> where it could be found easier.
>
> Is there anyway to change the behavior of strxfrm or strcoll?
> For example have caps before lowercase, instead of after?

You can probably get away with writing a strxfrm function that
spits out numbers that fit your definition of sorting.

-- 
Neil Cerutti
Whenever I see a homeless guy, I always run back and give him
money, because I think: Oh my God, what if that was Jesus?
--Pamela Anderson



More information about the Python-list mailing list