| Store | Cart

The Order Of Dictionary Entries

From: Aahz <a...@pythoncraft.com>
10 Mar 2004 06:57:58 -0500
In article <in93i1-ctp1.ln1 at eskimo.tundraware.com>,
Tim Daneliuk  <tundra at tundraware.com> wrote:
>>I am aware that dictionary order is not guaranteed.  But I ran into>something puzzling today.  I filled a dictionary dynamically as a>program ran.  Up to a certain point, the key order was the order>in which things were added.  However, at some point, the dictionary>appeared to reorder its contents in some non-deterministic way - in>fact, it looked like it was putting all the uppercase keys first,>followed by lowercase keys.>>I'm just curious, just what _is_ the approach used for ordering>dictionary keys?

Use the source, Luke.  See Objects/dictobject.c

Hint: dicts are based on hashing.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python

Recent Messages in this Thread
Tim Daneliuk Mar 10, 2004 11:11 am
Aahz Mar 10, 2004 11:57 am
Terry Reedy Mar 10, 2004 05:28 pm
Messages in this thread