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: 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> <554524B0.8000304@davea.name> Date: Sat, 2 May 2015 15:29:17 -0400 Subject: Re: Custom alphabetical sort From: Joel Goldstick Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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', '6', '7', '8', '9', >>> 'a', 'A', '=C3=A4', '=C3=84', '=C3=A1', '=C3=81', '=C3=A2', '=C3=82', '= =C3=A0', '=C3=80', '=C3=A5', '=C3=85', 'b', 'B', 'c', >>> 'C', '=C3=A7', '=C3=87', 'd', 'D', 'e', 'E', '=C3=AB', '=C3=8B', '=C3= =A9', '=C3=89', '=C3=AA', '=C3=8A', '=C3=A8', '=C3=88', >>> 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', '=C3=AF', '=C3=8F', '=C3=AD', '= =C3=8D', '=C3=AE', '=C3=8E', '=C3=AC', >>> '=C3=8C', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', '=C3=B1', 'N', '= =C3=91', 'o', 'O', >>> '=C3=B6', '=C3=96', '=C3=B3', '=C3=93', '=C3=B4', '=C3=94', '=C3=B2', '= =C3=92', '=C3=B8', '=C3=98', 'p', 'P', 'q', 'Q', 'r', >>> 'R', 's', 'S', 't', 'T', 'u', 'U', '=C3=BC', '=C3=9C', '=C3=BA', '=C3= =9A', '=C3=BB', '=C3=9B', '=C3=B9', '=C3=99', >>> 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z') >>> >>> How can I do this? The default sorted() does not give the desired resul= t. >>> >>> 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 desi= red > order didn't match any particular locale. > > > > -- > DaveA > -- > https://mail.python.org/mailman/listinfo/python-list Dave, he is the OP. Talking to himself? --=20 Joel Goldstick http://joelgoldstick.com