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


Groups > comp.lang.python > #40346

Re: Sorting (deeply) nested lists

X-Received by 10.224.175.65 with SMTP id w1mr13001623qaz.7.1362246540988; Sat, 02 Mar 2013 09:49:00 -0800 (PST)
X-Received by 10.49.12.130 with SMTP id y2mr1578929qeb.31.1362246540929; Sat, 02 Mar 2013 09:49:00 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!dd2no4414800qab.0!news-out.google.com!q17ni7qal.0!nntp.google.com!dd2no4414795qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
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
NNTP-Posting-Host 99.119.199.15
References <c4703b9f-44fd-4a6b-a600-b94de993bb4e@googlegroups.com> <mailman.2783.1362245815.2939.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <a6b8d573-495d-4c18-bfb0-975ccf44d8a2@googlegroups.com> (permalink)
Subject Re: Sorting (deeply) nested lists
From mamboknave@gmail.com
Cc python-list@python.org
Injection-Date Sat, 02 Mar 2013 17:49:00 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1625
Xref csiph.com comp.lang.python:40346

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 | Next 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