Fredrik Lundh <fredrik at pythonware.com> writes: > items = d.items() > items.sort(key=operator.itemgetter(1), reverse=True) > > the items list would require a couple of megabytes for 150k dictionary > entries, or so. the key map needs some memory too, but the rest of > the sort is done in place. I think the OP's method avoided the key map.