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


Groups > comp.lang.python > #30440

Re: creating an artificial "last element" in sort list

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <demianbrecht@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.032
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'anyway.': 0.04; 'url:github': 0.09; 'cc:addr:python-list': 0.10; 'naive': 0.16; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:@ 10': 0.27; 'subject:list': 0.28; "skip:' 10": 0.30; 'subject:last': 0.30; 'received:209.85.160.46': 0.32; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'subject:" ': 0.36; "didn't": 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'header:Received:5': 0.40; '100%': 0.76
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=UnLDMCCdy15JOtZOOUBEPBZ35ez6Adf68ccKxNeMBoA=; b=lu1kma5Llx12pDIZp4LJgZtXdTfUc3F2BObjZC15PEnL8l7zABuUaaodNVyGHfwJOu Zre7nX3s58ktRqdbElSexHoI5mo2K0LMzfOHG/PGujkxQIh8O7lBmpi7w59t1p55nNJF mfkvcmf48tRTP6LMWSDoBcdNAIEd6RNhkqGrBbrAgcdV7VcnmgcqUQtjhPm0wCpsteMu nP7P/IiiC2WOATGN64yBH3U2Ik4tW9xx/Nx1iXR4JZP/p0vJr9wOGLdNJ8kLyyhSGwxN V+CT+hiNpr0Bq3LRMKQ013YZlYcyWBj0P+Hwn4cpm7U0+Vkhvs24z4ax8Q7l1yDhaqhD Xnig==
Date Fri, 28 Sep 2012 17:32:17 -0700
From Demian Brecht <demianbrecht@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0
MIME-Version 1.0
To dave <davidreynon@gmail.com>
Subject Re: creating an artificial "last element" in sort list
References <7cd170ac-bb14-4baa-93ea-530c569d3985@googlegroups.com> <mailman.1587.1348875975.27098.python-list@python.org> <b3564f31-f54c-4c00-a6e7-f497911c054a@googlegroups.com>
In-Reply-To <b3564f31-f54c-4c00-a6e7-f497911c054a@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1591.1348878745.27098.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348878745 news.xs4all.nl 6895 [2001:888:2000:d::a6]:56361
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30440

Show key headers only | View raw


Apparently gmail hates me and my last response didn't get through:

a = ['awefawef', 'awefawfsf', 'awefsdf', 'zzzzzzzzzzzzzz', 
'zzzzzzzzzzzzzz', 'zzzzzzzzzzzzzz']
f = filter(lambda s: s == a[-1], a)
l = sorted(lst[:-len(f)]) + f

Now, not 100% sure about efficiency over large sizes of a, but that's a 
naive stab at it anyway.

-- 
Demian Brecht
@demianbrecht
http://demianbrecht.github.com

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


Thread

creating an artificial "last element" in sort list dave <davidreynon@gmail.com> - 2012-09-28 16:39 -0700
  Re: creating an artificial "last element" in sort list Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-28 17:45 -0600
    Re: creating an artificial "last element" in sort list dave <davidreynon@gmail.com> - 2012-09-28 16:51 -0700
      Re: creating an artificial "last element" in sort list 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-28 17:24 -0700
      Re: creating an artificial "last element" in sort list 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-28 17:24 -0700
      Re: creating an artificial "last element" in sort list Demian Brecht <demianbrecht@gmail.com> - 2012-09-28 17:32 -0700
        Re: creating an artificial "last element" in sort list Demian Brecht <demianbrecht@gmail.com> - 2012-09-28 17:59 -0700
          Re: creating an artificial "last element" in sort list Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-28 21:29 -0600
        Re: creating an artificial "last element" in sort list Demian Brecht <demianbrecht@gmail.com> - 2012-09-28 17:59 -0700
      Re: creating an artificial "last element" in sort list duncan smith <buzzard@invalid.invalid> - 2012-09-29 02:19 +0100
    Re: creating an artificial "last element" in sort list dave <davidreynon@gmail.com> - 2012-09-28 16:51 -0700
  Re: creating an artificial "last element" in sort list Paul Rubin <no.email@nospam.invalid> - 2012-09-28 18:42 -0700
  Re: creating an artificial "last element" in sort list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-29 02:05 +0000

csiph-web