Ordered dict by default

Terry Reedy tjreedy at udel.edu
Thu Feb 5 17:09:16 EST 2009


Paul Rubin wrote:
> bearophileHUGS at lycos.com writes:
>> Now Ruby dicts are ordered by default:
>> http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
> 
> Maybe I didn't read that carefully enough, but it looks like "ordered"
> means the dict records come out in the same order you inserted them
> in.  That is if you insert B,A,D,C in that order, you get them out in
> that order.

This seems to have become the more common meaning of 'ordered dict'.

>  I would have thought an ordered dict meant you get A,B,C,D,
> which seems a lot more useful.

I once thought that too, but this would be a 'sorted dict'.

tjr




More information about the Python-list mailing list