Why are there no ordered dictionaries?

Alex Martelli aleax at mail.comcast.net
Wed Nov 23 23:39:49 EST 2005


Christoph Zwerschke <cito at online.de> wrote:
   ...
> d.ksort() = d.sortkeys()
> d.asort() = d.sortvalues()
> 
> d.sort() could default to one of them (not sure which one).

Define JUST d.sort, you can trivially implement the other as
d.sort(key=d.get).


Alex



More information about the Python-list mailing list