Re: Flexible Collating (feedback please)

2006-10-20 Thread Leo Kislov
Ron Adam wrote: Leo Kislov wrote: Ron Adam wrote: locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect

Re: Flexible Collating (feedback please)

2006-10-20 Thread Ron Adam
Leo Kislov wrote: Ron Adam wrote: Leo Kislov wrote: Ron Adam wrote: locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect

Re: Flexible Collating (feedback please)

2006-10-19 Thread Leo Kislov
Ron Adam wrote: locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect (unexpectedly to the application) time.strftime() and C

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
Leo Kislov wrote: Ron Adam wrote: locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect (unexpectedly to the

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
[EMAIL PROTECTED] wrote: Ron Adam: Insted of: def __init__(self, flags=[]): self.flags = flags self.numrex = re.compile(r'([\d\.]*|\D*)', re.LOCALE) self.txtable = [] if HYPHEN_AS_SPACE in flags: self.txtable.append(('-', ' '))

Re: Flexible Collating (feedback please)

2006-10-18 Thread Ron Adam
I made a number of changes ... (the new version is listed below) These changes also resulted in improving the speed by about 3 times when all flags are specified. Collating now takes about 1/3 (or less) time. Although it is still quite a bit slower than a bare list.sort(), that is to be

Re: Flexible Collating (feedback please)

2006-10-18 Thread bearophileHUGS
Ron Adam: Insted of: def __init__(self, flags=[]): self.flags = flags self.numrex = re.compile(r'([\d\.]*|\D*)', re.LOCALE) self.txtable = [] if HYPHEN_AS_SPACE in flags: self.txtable.append(('-', ' ')) if UNDERSCORE_AS_SPACE in