Re: Sorting Objects by property using locale

2007-12-21 Thread Donn Ingle
> Which is even more correct than I hoped for -- in Norwegian, aa is > pronounced the same as å (which is the 29th letter in the Norwegian > alphabet) and is sorted according to pronunciation. Much appreciated bjorn. \d -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting Objects by property using locale

2007-12-21 Thread Donn Ingle
In follow-up: I think this should work: # -*- coding: utf8 -*- import locale locale.setlocale( locale.LC_ALL, "" ) class Test(object): def __init__(self,nam): self.name = nam def __cmp__(self, other): return cmp(self.name, other.name) l = [ Test("ABILENE.ttf"), Te

Re: Sorting Objects by property using locale

2007-12-21 Thread thebjorn
Donn Ingle wrote: > Hi, > Well, I'm beat. I can't wrap my head around this stuff. > > I need to create a list that will contain objects sorted by a "name" > property that is in the alphabetical order of the user's locale. > > I used to have a simple list that I got from os.listdir and I could do

Sorting Objects by property using locale

2007-12-21 Thread Donn Ingle
Hi, Well, I'm beat. I can't wrap my head around this stuff. I need to create a list that will contain objects sorted by a "name" property that is in the alphabetical order of the user's locale. I used to have a simple list that I got from os.listdir and I could do this: l = os.listdir(".") l.so