Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; "'a'": 0.07; 'sep': 0.09; '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; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'run': 0.28; 'appending': 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'subject:last': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'subject:" ': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'matter': 0.61; 'first': 0.61; 'within': 0.64; 'making': 0.64; 'believe': 0.69; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=TjrkoNSBYPFpHOEEh4HbyCBtK+pnyqWE1NilxNyim6U=; b=MURBogc+v+1EsGKPFH/rZ9x1vcsrFQof7E/CEFuadhw/p7buvU0CuN9fr4XeWpvfLH sCLNUJd3hah6d6kEbV+jAU5hm7Xql3Y8K1vga8R0hwz9rufPMA2KoMcsrp6aLHAV92PF eT6sbRwnp8pNEzPSqsqRqH/mMwyA3rycmNLyJJfupFgrkkLBZjCefZjzkn/QMUdPgfsN 2pvyOa9GTfhHT1diKC05F+Kb+cTPjHWmReDQYQX8K705wWplLaWaJDakyMqqKoUQvTXO mjvA62agYwDePyvs6HLpW5DI3oPMIQi/rTOTByzBNgCICYSEA+tPWEpZSvTW5zd6eKog v1xg== MIME-Version: 1.0 In-Reply-To: <7cd170ac-bb14-4baa-93ea-530c569d3985@googlegroups.com> References: <7cd170ac-bb14-4baa-93ea-530c569d3985@googlegroups.com> From: Ian Kelly Date: Fri, 28 Sep 2012 17:45:43 -0600 Subject: Re: creating an artificial "last element" in sort list To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348875975 news.xs4all.nl 6897 [2001:888:2000:d::a6]:36611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30433 On Fri, Sep 28, 2012 at 5:39 PM, dave wrote: > a =3D ['a', 'b', x] > > b =3D sorted(a) > > What does x need to be to always be last on an ascending sort no matter w= hat '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 'zzzzzzzzzzzzzzzz'= and believe it or not, this appears FIRST on the sort!!! It appears last when I run the code. To answer your question, though, if you want to force x to be last, then I suggest removing it from the list and then appending it to the end.