Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30462
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.straub-nv.de!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.040 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'anyway.': 0.04; 'backwards': 0.09; 'sep': 0.09; 'received:mail- wi0-f178.google.com': 0.16; 'wrote:': 0.17; 'element': 0.17; 'assumes': 0.22; 'assuming': 0.22; "i'd": 0.22; 'matching': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'subject:list': 0.28; 'fri,': 0.30; 'subject:last': 0.30; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'locations': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'subject:" ': 0.36; "wasn't": 0.36; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'walk': 0.71; 'upper': 0.75; 'guaranteed': 0.76; '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=fccvBE4m98POtyNFAdxypDuYBv9T/PwUpnwLAPfR0VE=; b=R29NA8Sv+q5fLMQZ0w0LWyMNrWet5NQka6OlVH+iyY/9mrbaHcgTNx/Uf64eRQHwFF kCO2/z79Pbi635DZQnL/jtMWKe5/VZszIlDuXKJBwf3aMgjU4/klwqjy6qH4Emw6y8Gi hKLsd1H5/tHrYrXRQxJ8gzLbyCB8ry2adVv+23U3t+4+Fa+02enIuhlDLc2AI6cOwZFm 9dCKog+sHEwtER+RQTPsqP8FhM/o08NpuwGi+C+0kV0ubDvivf7JYAcep7TYU1UNVMwE brrMQWr8JCwHhVf5TgdSeyPCmqGY3qw7bDi1Dl3tVCqmYxEw1XZopWFhyscxBhbcbB5k fMmA== |
| MIME-Version | 1.0 |
| In-Reply-To | <16506499-9803-4f68-8269-f201863574c9@googlegroups.com> |
| References | <7cd170ac-bb14-4baa-93ea-530c569d3985@googlegroups.com> <mailman.1587.1348875975.27098.python-list@python.org> <b3564f31-f54c-4c00-a6e7-f497911c054a@googlegroups.com> <mailman.1591.1348878745.27098.python-list@python.org> <16506499-9803-4f68-8269-f201863574c9@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 28 Sep 2012 21:29:53 -0600 |
| Subject | Re: creating an artificial "last element" in sort list |
| To | Python <python-list@python.org> |
| 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 <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.1601.1348889426.27098.python-list@python.org> (permalink) |
| Lines | 11 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348889426 news.xs4all.nl 6866 [2001:888:2000:d::a6]:49176 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30462 |
Show key headers only | View raw
On Fri, Sep 28, 2012 at 6:59 PM, Demian Brecht <demianbrecht@gmail.com> wrote: >> f = filter(lambda s: s == a[-1], a) > > That line's assuming that the last element may also be found in arbitrary locations in the list. If it's guaranteed that they're all contiguous at the upper bounds, I'd just walk the list backwards until I found one that wasn't matching rather than filtering. The slicing operation in the second line assumes that they're all collected at the end of the list anyway.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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