Why are there no ordered dictionaries?

Alex Martelli aleax at mail.comcast.net
Thu Nov 24 05:39:49 CET 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