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


Groups > comp.lang.python > #86773

Re: Sort list of dictionaries

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'source.': 0.07; '%s"': 0.09; 'posted': 0.15; 'charles': 0.16; 'elem:': 0.16; 'sorting': 0.16; 'subject:Sort': 0.16; 'subject:dictionaries': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'trying': 0.19; 'header:User- Agent:1': 0.23; 'skip:l 30': 0.24; 'sorry,': 0.24; "haven't": 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'subject:list': 0.30; 'agree': 0.35; 'problem.': 0.35; 'but': 0.35; 'version': 0.36; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'numbers': 0.61; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; 'remarks': 0.84
Date Mon, 02 Mar 2015 13:59:50 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Sort list of dictionaries
References <f1a339d0-0386-43ba-b6b4-1aee39d75581@googlegroups.com> <mailman.56.1425321135.13471.python-list@python.org> <946797be-10e6-433b-9411-2db0d5697ac8@googlegroups.com>
In-Reply-To <946797be-10e6-433b-9411-2db0d5697ac8@googlegroups.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:YKO4ZVLylVP/oPuOdT/F/JNqVfCU836xURJnihH3dNs Y6xJ5k7QSP+SWpIEZi6SY0vMC+g5jcXwJLZhRBMw3KCmWWuhsA EdC/FkgAKA2XjDhJ7cAraI/Hor3W9wPBMyOawKg5BDfEyz+15B yJMrPsqpatT5en0EI6e5vrMnArwLqM3+JgTTYIGzB8y2nNmsdd Fj7VurqogGxmskm8k/hyBp7SQXJBVd5DKHHWFRTStyKvh0RiR8 EYhc6T+poxpaGOByISz52tjDecAFyD3VeyibImBzlNOVpJ9Mmi +hTsKR8UCEBA2puCc32Mr6baRmX3J7FiiqLf49qbI5rOlWySrL U/gWncfbJ3h7rtWoKS1k=
X-UI-Out-Filterresults notjunk:1;
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.59.1425322796.13471.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1425322796 news.xs4all.nl 2899 [2001:888:2000:d::a6]:44765
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86773

Show key headers only | View raw


On 03/02/2015 01:38 PM, Charles Heizer wrote:
> Sorry,
>
> sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], LooseVersion(elem['version'])), reverse=True)
>
> This is what I was trying but LooseVersion() was not sorting version numbers like I thought it would. You will notice that Chrome version "40.0.2214.111" is higher than "40.0.2214.91" but in the end result it's not sorting it that way.
>

Please don't top-post.  put your remarks after whatever quoting you do.

You still haven't posted your LooseVersion() function source.  I agree 
with Emile that it's likely to be the problem.


-- 
DaveA

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


Thread

Sort list of dictionaries Charles Heizer <ceh329@gmail.com> - 2015-03-02 10:17 -0800
  Re: Sort list of dictionaries Emile van Sebille <emile@fenx.com> - 2015-03-02 10:31 -0800
    Re: Sort list of dictionaries Charles Heizer <ceh329@gmail.com> - 2015-03-02 10:38 -0800
      Re: Sort list of dictionaries Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-02 11:55 -0700
      Re: Sort list of dictionaries Charles Heizer <ceh329@gmail.com> - 2015-03-02 10:58 -0800
        Re: Sort list of dictionaries Peter Otten <__peter__@web.de> - 2015-03-02 20:23 +0100
          Re: Sort list of dictionaries Charles Heizer <ceh329@gmail.com> - 2015-03-03 07:56 -0800
            Re: Sort list of dictionaries Chris Angelico <rosuav@gmail.com> - 2015-03-04 03:09 +1100
              Re: Sort list of dictionaries Paul  Moore <p.f.moore@gmail.com> - 2015-03-03 08:48 -0800
            Re: Sort list of dictionaries Peter Otten <__peter__@web.de> - 2015-03-03 18:44 +0100
      Re: Sort list of dictionaries Dave Angel <davea@davea.name> - 2015-03-02 13:59 -0500
      Re: Sort list of dictionaries Jason Friedman <jsf80238@gmail.com> - 2015-03-02 22:33 -0700
      Re: Sort list of dictionaries Chris Angelico <rosuav@gmail.com> - 2015-03-03 18:07 +1100
      Re: Sort list of dictionaries Jason Friedman <jsf80238@gmail.com> - 2015-03-03 07:45 -0700
      Re: Sort list of dictionaries Chris Angelico <rosuav@gmail.com> - 2015-03-04 01:50 +1100
  Re: Sort list of dictionaries Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 18:55 +1100

csiph-web