Is numeric keys of Python's dictionary automatically sorted?
antroy at gmail.com
Wed Mar 7 21:41:40 CET 2007
On Mar 7, 8:18 pm, "John" <rds1... at sh163.net> wrote:
> However, I am not sure whether it is always like this. Can anybody confirm
> my finding?
>From the standard library docs:
"Keys and values are listed in an arbitrary order which is non-random,
varies across Python implementations, and depends on the dictionary's
history of insertions and deletions."
i.e. the behaviour you have discovered is an implementation detail,
and could change in future versions.
More information about the Python-list