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


Groups > comp.lang.python > #89789

Re: Custom alphabetical sort

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'responding': 0.07; 'locale': 0.09; '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; 'sorted()': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'all,': 0.19; 'result.': 0.19; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'url:python': 0.33; 'monday,': 0.33; 'december': 0.35; "didn't": 0.36; 'url:org': 0.36; 'starting': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'how': 0.40; 'url:3': 0.61; "you're": 0.61; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; 'default': 0.69; "'2',": 0.84; "'3',": 0.84; 'order:': 0.84
Date Sat, 02 May 2015 15:25:36 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Custom alphabetical sort
References <40d108ec-b019-4829-a969-c8ef513866f1@googlegroups.com> <e383c003-1fff-4fd9-b6a2-222e0a436e6d@googlegroups.com>
In-Reply-To <e383c003-1fff-4fd9-b6a2-222e0a436e6d@googlegroups.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Provags-ID V03:K0:urNugTIEWiR4WR4eXdjmIXIXrwxSaoCVqaaTCw6QXaExMsuQ9T8 QSIWW7FgLBOnGQ3XjmpIBJwlMPG3dg8c05X+lcz7X7fdk/U9E/Uilk4ShS153hWV4i4Rt/J 71wTgTu4izXeYCpSZwDaFIzwe2oUKLFOqozaFkk1xKIXP5lmoIMt+rmz5eKD19iJUjpc6o9 m8HA5sl9y2VZ8bwXr432Q==
X-UI-Out-Filterresults notjunk:1;
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.24.1430594753.12865.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1430594753 news.xs4all.nl 2867 [2001:888:2000:d::a6]:50167
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:89789

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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