Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #89791

Re: Custom alphabetical sort

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'responding': 0.07; 'locale': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "'0',": 0.16; "'a',": 0.16; "'b',": 0.16; "'c',": 0.16; "'d',": 0.16; "'e',": 0.16; "'o',": 0.16; "'r',": 0.16; "'w',": 0.16; 'meanwhile': 0.16; 'op.': 0.16; 'sorted()': 0.16; 'sat,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'all,': 0.19; 'result.': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'cc:2**0': 0.24; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'monday,': 0.33; 'december': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; "didn't": 0.36; 'url:org': 0.36; 'starting': 0.37; 'fact': 0.38; 'pm,': 0.38; 'does': 0.39; 'according': 0.40; 'url:mail': 0.40; 'how': 0.40; 'dave': 0.60; 'url:3': 0.61; "you're": 0.61; 'talking': 0.65; 'default': 0.69; "'2',": 0.84; "'3',": 0.84; '2015': 0.84; 'order:': 0.84; 'angel': 0.91; 'joel': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=8eSxVrqCkKCdXbEIqHQfWvhXVjotxA+zsiiIwL4Oq/Y=; b=GYLWMIK5BDoOo02GEMlwCWQxig8bHZW5U8/mIQnRZib52WKt3dSN+e34+fyudLQNPS VT8SPQXII18mma2PW0IMWDLj2UkbrUhXIiEpO2GQ35y3XKkJ4qJDtoD8ouNHRr7lbuV0 QfGeiF4nEZM8UKDaIUrFFnyDyqlvHE3OY6ewkCeFVg9ZMtGV0PV+PPxUvoRiayz0h/e0 0FZahBv6SNY7zegjUYJx77B2q6oVbmj+ldZvo9ViH5IH3eZadOMjWqWLieCocDOGSd7y 0GJdNmDXgQ6E7xNrAthF6Xp9trMm5P+MlFIZKjfkTZSCFYGTvE2hY6g1geuv09icci/a AjMg==
MIME-Version 1.0
X-Received by 10.50.138.232 with SMTP id qt8mr4683860igb.28.1430594957893; Sat, 02 May 2015 12:29:17 -0700 (PDT)
In-Reply-To <554524B0.8000304@davea.name>
References <40d108ec-b019-4829-a969-c8ef513866f1@googlegroups.com> <e383c003-1fff-4fd9-b6a2-222e0a436e6d@googlegroups.com> <554524B0.8000304@davea.name>
Date Sat, 2 May 2015 15:29:17 -0400
Subject Re: Custom alphabetical sort
From Joel Goldstick <joel.goldstick@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.25.1430594966.12865.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1430594966 news.xs4all.nl 2854 [2001:888:2000:d::a6]:52882
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:89791

Show key headers only | View raw


On Sat, May 2, 2015 at 3:25 PM, Dave Angel <davea@davea.name> 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', '6', '7', '8', '9',
>>> 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c',
>>> 'C', 'ç', 'Ç', 'd', 'D', 'e', 'E', 'ë', 'Ë', 'é', 'É', 'ê', 'Ê', 'è', 'È',
>>> 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'ï', 'Ï', 'í', 'Í', 'î', 'Î', 'ì',
>>> 'Ì', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'ñ', 'N', 'Ñ', 'o', 'O',
>>> 'ö', 'Ö', 'ó', 'Ó', 'ô', 'Ô', 'ò', 'Ò', 'ø', 'Ø', 'p', 'P', 'q', 'Q', 'r',
>>> 'R', 's', 'S', 't', 'T', 'u', 'U', 'ü', 'Ü', 'ú', 'Ú', 'û', 'Û', 'ù', 'Ù',
>>> 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z')
>>>
>>> How can I do this? The default sorted() does not give the desired result.
>>>
>>> Thanks,
>>>
>>> Pander
>>
>>
>> Meanwhile Python 3 supports locale aware sorting, see
>> https://docs.python.org/3/howto/sorting.html
>>
>
> You're aware that the message you're responding to is 16 months old?
>
> And answered pretty thoroughly, starting with the fact that the OP's desired
> order didn't match any particular locale.
>
>
>
> --
> DaveA
> --
> https://mail.python.org/mailman/listinfo/python-list

Dave, he is the OP.  Talking to himself?

-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Custom alphabetical sort Pander Musubi <pander.musubi@gmail.com> - 2015-05-02 08:35 -0700
  Re: Custom alphabetical sort Dave Angel <davea@davea.name> - 2015-05-02 15:25 -0400
  Re: Custom alphabetical sort Joel Goldstick <joel.goldstick@gmail.com> - 2015-05-02 15:29 -0400

csiph-web