question about dictionaries

Brett Hoerner bretthoerner at gmail.com
Thu Jan 19 20:04:38 EST 2006


Chris wrote:
> Is there a way to stop this behavior? I want to process this dictionary
> in the order it's in, element by element. I'm running Python 2.3, if
> that helps.

As said previously, you either want a list (which are ordered), or an
ordered-dictionary (not a Python native type, see
http://www.voidspace.org.uk/python/odict.html)

dict datatypes do not maintain any specific order and aren't really
meant to, they're just handy, 'fast' hash lookups.

Brett




More information about the Python-list mailing list