Regarding Dictionaries in python

laotseu bdesth at removethis.free.fr
Mon Apr 21 21:07:34 EDT 2003


Mehta, Anish wrote:
> Hello !
> 
> I am having a small query regarding dictionaries in python. From 
> Orelly's Programming Python
> 
>  >>>D= {'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4}
>  >>>D.items()
> [ ('b', 2), ('c', 3), ('d', 4), ('a', 1)]
> 
> 
> why it is not showing the items in order in which i have inserted. 
> Please tell me why it is happing like this.

Because dictionnaries in python are not ordered. I think (not sure 
but...) this is in the Python doc...


Laotseu





More information about the Python-list mailing list