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: 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: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: 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 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!