Re: [Python-Dev] Propose to reject PEP 265 -- Sorting Dictionaries by Value

2005-06-16 Thread Guido van Rossum
On 6/16/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Agreed. I don't want to add sorting abilities (with all its infinite > variants) to every data structure -- or even one or two common data > structures. You want something sorted that's not already a list? Use > the sorted() method. I meant

Re: [Python-Dev] Propose to reject PEP 265 -- Sorting Dictionaries by Value

2005-06-16 Thread Guido van Rossum
Agreed. I don't want to add sorting abilities (with all its infinite variants) to every data structure -- or even one or two common data structures. You want something sorted that's not already a list? Use the sorted() method. On 6/16/05, Steven Bethard <[EMAIL PROTECTED]> wrote: > Raymond Hetting

Re: [Python-Dev] Propose to reject PEP 265 -- Sorting Dictionaries by Value

2005-06-16 Thread Steven Bethard
Raymond Hettinger wrote: > May I suggest rejecting PEP 265. > > As of Py2.4, its use case is easily solved with: > > >>> sorted(d.iteritems(), key=itemgetter(1), reverse=True) > [('b', 23), ('d', 17), ('c', 5), ('a', 2), ('e', 1)] +1. I find that usually when I want something like this, I use:

[Python-Dev] Propose to reject PEP 265 -- Sorting Dictionaries by Value

2005-06-16 Thread Raymond Hettinger
May I suggest rejecting PEP 265. As of Py2.4, its use case is easily solved with: >>> sorted(d.iteritems(), key=itemgetter(1), reverse=True) [('b', 23), ('d', 17), ('c', 5), ('a', 2), ('e', 1)] Further, Py2.5 offers a parallel solution to the more likely use case of wanting the access only the l