Re: Sub-sort after sort

2007-11-02 Thread Paul Hankin
On Nov 2, 9:45 pm, [EMAIL PROTECTED] wrote: > Hello, I have been sorting a list of dicts using the following > function: > > result_rs = sorted(unsort_rs, key=itemgetter(orderby)) > > and this works fine. Now I am looking to perform a subsort as well. > For example, I have this: > > test = [{'name'

Re: Sub-sort after sort

2007-11-02 Thread KeefTM
On Nov 2, 3:36 pm, "Andrew Koenig" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > I would want to sort by name first, then sub sort by location. Any > > ideas? Thanks! > > In Python 2.3 and later, sorting is stable -- so you can sort successively

Re: Sub-sort after sort

2007-11-02 Thread KeefTM
On Nov 2, 3:36 pm, "Andrew Koenig" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > I would want to sort by name first, then sub sort by location. Any > > ideas? Thanks! > > In Python 2.3 and later, sorting is stable -- so you can sort successively

Re: Sub-sort after sort

2007-11-02 Thread Andrew Koenig
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would want to sort by name first, then sub sort by location. Any > ideas? Thanks! In Python 2.3 and later, sorting is stable -- so you can sort successively in reverse order. In other words, sort the list by location, then sort th

Re: Sub-sort after sort

2007-11-02 Thread KeefTM
On Nov 2, 2:45 pm, [EMAIL PROTECTED] wrote: > Hello, I have been sorting a list of dicts using the following > function: > > result_rs = sorted(unsort_rs, key=itemgetter(orderby)) > > and this works fine. Now I am looking to perform a subsort as well. > For example, I have this: > > test = [{'name'

Sub-sort after sort

2007-11-02 Thread keeftm
Hello, I have been sorting a list of dicts using the following function: result_rs = sorted(unsort_rs, key=itemgetter(orderby)) and this works fine. Now I am looking to perform a subsort as well. For example, I have this: test = [{'name': 'John Smith', 'location': 'CA',},{'name': 'John Smith', '