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 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: > sorted(d, key=d.__getitem__, reverse=True) > because it doesn't require the operator module and most of the time I > just need the keys anyway. > > py> sorted(d, key=d.__getitem__, reverse=True) > ['b', 'd', 'c', 'a', 'e'] > > Steve > -- > You can wordify anything if you just verb it. > --- Bucky Katt, Get Fuzzy > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com