"Ordered" dicts

Simon Brunning simon.brunning at gmail.com
Wed Aug 10 16:23:49 CEST 2005

On 8/10/05, Chris Cioffi <evenprimes at gmail.com> wrote:
> While the sorted() built in addressed (yet another) community desire, I
> don't think this addresses the underlying expectation of getting dictionary
> keys in some order.  

You do get them in *some* order. ;-)
> It works, but it feel like a kludge to me. <shrug> 

To me, it's elegant. Want the keys? Call .keys(). Want them sorted?
Call sorted(). Each tool does one job well.

Simon B,
simon at brunningonline.net,

More information about the Python-list mailing list