[Tutor] key/value order in dictionaries
cfuller084 at thinkingplanet.net
Fri Aug 1 04:57:43 CEST 2008
On Thursday 31 July 2008 05:33, Monika Jisswel wrote:
> Python dictionaries are not ordered & the order you will get when you print
> a dictionary is the order that the python virtual machines thinks optimal
> for that dictionary for its own internal procedures.
If you need an ordered dictionary, such things exist. The implementation I
use is at http://www.voidspace.org.uk/python/modules.shtml, but there may be
one or two other popular ones out there. You probably shouldn't use them
unless you have a specific need to. They will be a lot slower, and extra
dependencies always complicates distribution.
More information about the Tutor