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


Groups > comp.lang.python > #40347

Re: Sorting (deeply) nested lists

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.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
Return-Path <mamboknave@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.048
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'index': 0.13; 'indexerror:': 0.16; 'item:': 0.16; 'lambda': 0.16; 'wrote:': 0.17; 'subject:) ': 0.20; 'posted': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'subject:lists': 0.32; 'received:google.com': 0.34; 'wrong': 0.34; 'thanks': 0.34; 'list': 0.35; 'so,': 0.35; 'subject: (': 0.36; 'subject:: ': 0.38; 'from:no real name:2**0': 0.60; 'replying': 0.64; '2013': 0.84; 'otten': 0.84; 'reply,': 0.93
X-Received by 10.49.12.130 with SMTP id y2mr1578929qeb.31.1362246540929; Sat, 02 Mar 2013 09:49:00 -0800 (PST)
Newsgroups comp.lang.python
Date Sat, 2 Mar 2013 09:49:00 -0800 (PST)
In-Reply-To <mailman.2783.1362245815.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=99.119.199.15; posting-account=spHjNgoAAAAlfnyJF7qz-h54hyM0w9rC
References <c4703b9f-44fd-4a6b-a600-b94de993bb4e@googlegroups.com> <mailman.2783.1362245815.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 99.119.199.15
MIME-Version 1.0
Subject Re: Sorting (deeply) nested lists
From mamboknave@gmail.com
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc 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>
Message-ID <mailman.2784.1362246550.2939.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362246550 news.xs4all.nl 6927 [2001:888:2000:d::a6]:41032
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40347

Show key headers only | View raw


On Saturday, March 2, 2013 9:36:43 AM UTC-8, Peter Otten wrote:
>
> You can also write this as
> 
> namedTuples.sort(key=lambda item: item[1][1])
>

That's exactly what I did before and got "IndexError: list index out of range".

So, I thought my lambda was wrong and posted here.

Now, having seen you reply, I dug deeper and... of course I had IndexError: the list was horribly empty!

Thanks so much for replying so quickly, Peter!

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


Thread

Sorting (deeply) nested lists mamboknave@gmail.com - 2013-03-02 09:18 -0800
  Re: Sorting (deeply) nested lists Peter Otten <__peter__@web.de> - 2013-03-02 18:36 +0100
    Re: Sorting (deeply) nested lists mamboknave@gmail.com - 2013-03-02 09:49 -0800
    Re: Sorting (deeply) nested lists mamboknave@gmail.com - 2013-03-02 09:49 -0800

csiph-web