Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; "'a'": 0.07; 'friday,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'suggest': 0.11; "'b'": 0.16; "'b',": 0.16; "['a',": 0.16; 'ascending': 0.16; 'wrote:': 0.17; 'appears': 0.18; 'code.': 0.20; 'sort': 0.21; 'not,': 0.21; 'cc:2**0': 0.23; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'subject:list': 0.28; 'run': 0.28; 'appending': 0.29; "skip:' 10": 0.30; 'subject:last': 0.30; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'subject:" ': 0.36; 'does': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'matter': 0.61; 'first': 0.61; 'more': 0.63; 'within': 0.64; 'making': 0.64; 'believe': 0.69; 'received:209.85.216.184': 0.84; 'realistic': 0.93 Newsgroups: comp.lang.python Date: Fri, 28 Sep 2012 16:51:10 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=207.171.30.170; posting-account=oWbVawoAAACk0KmGeRJYYISQTRuqDMF7 References: <7cd170ac-bb14-4baa-93ea-530c569d3985@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 207.171.30.170 MIME-Version: 1.0 Subject: Re: creating an artificial "last element" in sort list From: dave To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348876273 news.xs4all.nl 6896 [2001:888:2000:d::a6]:39930 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:30435 more clearer, this is a more realistic use case: ['awefawef', 'awefawfsf', 'awefsdf', 'zzzzzzzzzzzzzz', 'zzzzzzzzzzzzzz', 'z= zzzzzzzzzzzzz'] and the quantity of ''zzzzzzzzzzzzzz'' would be dynamic. On Friday, September 28, 2012 4:46:15 PM UTC-7, Ian wrote: >=20 > > a =3D ['a', 'b', x] >=20 > > >=20 > > b =3D sorted(a) >=20 > > >=20 > > What does x need to be to always be last on an ascending sort no matter= what 'a' and 'b' are.... within reason... I am expecting 'a' and 'b' will = be not longer than 10 char's long.... I tried making x =3D 'zzzzzzzzzzzzzzz= z' and believe it or not, this appears FIRST on the sort!!! >=20 >=20 >=20 > It appears last when I run the code. >=20 >=20 >=20 > To answer your question, though, if you want to force x to be last, >=20 > then I suggest removing it from the list and then appending it to the >=20 > end.