Weird...

Jaime Wyant programmer.py at gmail.com
Mon Apr 11 08:52:02 EDT 2005


Dictionary keys have no defined order.  This is what the docs say about that:

Keys and values are listed in random order. If items(), keys(),
values(), iteritems(), iterkeys(), and itervalues() are called with no
intervening modifications to the dictionary, the lists will directly
correspond.

jw

On Apr 10, 2005 4:57 PM, Joshua Ginsberg <listspam at flowtheory.net> wrote:
>  >>> {'a':1,'b':'2','c':[3,4]}.keys()
> ['a', 'c', 'b']
> 
> How come? :-)
> 
> -jag
> 
> Python 2.3.3 (#1, May  7 2004, 10:31:40)
> [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
> 
> 
> 
> Joshua Ginsberg -- joshg at brainstorminternet.net
> Brainstorm Internet Network Operations
> 970-247-1442 x131
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
>



More information about the Python-list mailing list