Re: Custom alphabetical sort

2015-05-02 Thread Joel Goldstick
On Sat, May 2, 2015 at 3:25 PM, Dave Angel wrote: > On 05/02/2015 11:35 AM, Pander Musubi wrote: >> >> On Monday, 24 December 2012 16:32:56 UTC+1, Pander Musubi wrote: >>> >>> Hi all, >>> >>> I would like to sort according to this order: >>> >>> (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5',

Re: Custom alphabetical sort

2015-05-02 Thread Dave Angel
On 05/02/2015 11:35 AM, Pander Musubi wrote: On Monday, 24 December 2012 16:32:56 UTC+1, Pander Musubi wrote: Hi all, I would like to sort according to this order: (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', '

Re: Custom alphabetical sort

2015-05-02 Thread Pander Musubi
On Monday, 24 December 2012 16:32:56 UTC+1, Pander Musubi wrote: > Hi all, > > I would like to sort according to this order: > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C', > 'ç', 'Ç',

Re: Custom alphabetical sort

2012-12-28 Thread wxjmfauth
Le vendredi 28 décembre 2012 00:17:53 UTC+1, Ian a écrit : > On Thu, Dec 27, 2012 at 3:17 PM, Terry Reedy wrote: > > >> PS Py 3.3 warranty: ~30% slower than Py 3.2 > > > > > > > > > Do you have any actual timing data to back up that claim? > > > If so, please give specifics, including build,

Re: Custom alphabetical sort

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 3:17 PM, Terry Reedy wrote: >> PS Py 3.3 warranty: ~30% slower than Py 3.2 > > > Do you have any actual timing data to back up that claim? > If so, please give specifics, including build, os, system, timing code, and > result. There was another thread about this one a whil

Re: Custom alphabetical sort

2012-12-27 Thread Terry Reedy
On 12/27/2012 1:17 PM, wxjmfa...@gmail.com wrote: Le lundi 24 décembre 2012 16:32:56 UTC+1, Pander Musubi a écrit : I would like to sort according to this order: (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', '

Re: Custom alphabetical sort

2012-12-27 Thread wxjmfauth
Le lundi 24 décembre 2012 16:32:56 UTC+1, Pander Musubi a écrit : > Hi all, > > > > I would like to sort according to this order: > > > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C',

Re: Custom alphabetical sort

2012-12-26 Thread Joshua Landau
On 25 December 2012 06:18, Dave Angel wrote: > On 12/24/2012 06:19 PM, Pander Musubi wrote: > > Thanks very much for this efficient code. > > Perhaps you missed Ian Kelly's correction of Thomas Bach's approach: > > d = { k: v for v, k in enumerate(cs) } > > > def collate(x): > return lis

Re: Custom alphabetical sort

2012-12-24 Thread Dave Angel
On 12/24/2012 06:19 PM, Pander Musubi wrote: > > to prevent > > Traceback (most recent call last): > File "./sort.py", line 23, in > things_to_sort.sort(key=string2sortlist) > File "./sort.py", line 15, in string2sortlist > return [hashindex[s] for s in string] > KeyError: '\xc3' > >

Re: Custom alphabetical sort

2012-12-24 Thread Pander Musubi
On Monday, December 24, 2012 7:12:43 PM UTC+1, Joshua Landau wrote: > On 24 December 2012 16:18, Roy Smith wrote: > > > > > In article <40d108ec-b019-4829-a969-c8ef51386...@googlegroups.com>, > >  Pander Musubi wrote: > > > > > Hi all, > > > > > > > I would like to sort according to th

Re: Custom alphabetical sort

2012-12-24 Thread Steven D'Aprano
On Mon, 24 Dec 2012 11:18:37 -0500, Roy Smith wrote: > In article <40d108ec-b019-4829-a969-c8ef51386...@googlegroups.com>, > Pander Musubi wrote: > >> Hi all, >> >> I would like to sort according to this order: [...] > I'm assuming that doesn't correspond to some standard locale's collating > o

Re: Custom alphabetical sort

2012-12-24 Thread Mark Lawrence
On 24/12/2012 17:40, Roy Smith wrote: In article <46db479a-d16f-4f64-aaf2-76de65418...@googlegroups.com>, Pander Musubi wrote: I'm assuming that doesn't correspond to some standard locale's collating order, so we really do need to roll our own encoding (and that you have a good reason for wa

Re: Custom alphabetical sort

2012-12-24 Thread Joshua Landau
On 24 December 2012 16:18, Roy Smith wrote: > In article <40d108ec-b019-4829-a969-c8ef51386...@googlegroups.com>, > Pander Musubi wrote: > > > Hi all, > > > > I would like to sort according to this order: > > > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', > 'a', > >

Re: Custom alphabetical sort

2012-12-24 Thread Pander Musubi
> > > > > > I'm assuming that doesn't correspond to some standard locale's collating > > > > order, so we really do need to roll our own encoding (and that you have > > > > a good reason for wanting to do this). > > > > > > It is for creating a Dutch dictionary. > > > > Wait a minute.

Re: Custom alphabetical sort

2012-12-24 Thread Roy Smith
In article <46db479a-d16f-4f64-aaf2-76de65418...@googlegroups.com>, Pander Musubi wrote: > > I'm assuming that doesn't correspond to some standard locale's collating > > order, so we really do need to roll our own encoding (and that you have > > a good reason for wanting to do this). > > It i

Re: Custom alphabetical sort

2012-12-24 Thread Ian Kelly
On Dec 24, 2012 9:37 AM, "Pander Musubi" wrote: > > >>> ''.join(sorted(random.sample(cs, 20), key=d.get)) > > > > '5aAàÀåBCçËÉíÎLÖøquùx' > > This doesn't work for words with more than one character: Try this instead: def collate(x): return list(map(d.get, x)) sorted(data, key=collate) I w

Re: Custom alphabetical sort

2012-12-24 Thread Pander Musubi
> > Hi all, > > > > > > I would like to sort according to this order: > > > > > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > > > 'A', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'b', 'B', 'c', 'C', > > > '?', '?', 'd', 'D', 'e', 'E', '?', '?', '?', '?

Re: Custom alphabetical sort

2012-12-24 Thread Pander Musubi
On Monday, December 24, 2012 5:11:03 PM UTC+1, Thomas Bach wrote: > On Mon, Dec 24, 2012 at 07:32:56AM -0800, Pander Musubi wrote: > > > I would like to sort according to this order: > > > > > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', > > 'a', 'A', 'ä', 'Ä', 'á'

Re: Custom alphabetical sort

2012-12-24 Thread Roy Smith
In article <40d108ec-b019-4829-a969-c8ef51386...@googlegroups.com>, Pander Musubi wrote: > Hi all, > > I would like to sort according to this order: > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > 'A', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'b', 'B',

Re: Custom alphabetical sort

2012-12-24 Thread Thomas Bach
On Mon, Dec 24, 2012 at 07:32:56AM -0800, Pander Musubi wrote: > I would like to sort according to this order: > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C', > 'ç', 'Ç', 'd', 'D', 'e',

Custom alphabetical sort

2012-12-24 Thread Pander Musubi
Hi all, I would like to sort according to this order: (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C', 'ç', 'Ç', 'd', 'D', 'e', 'E', 'ë', 'Ë', 'é', 'É', 'ê', 'Ê', 'è', 'È', 'f', 'F', 'g', 'G'