> From: Alan Isaac > > I'm sure my first pass will be flawed, but here goes: > > http://docs.python.org/lib/typesmapping.html: > to footnote (3), add phrase "which may depend on the memory location of > the > keys" to get: > > Keys and values are listed in an arbitrary order, > which may depend on the memory location of the keys. > This order is non-random, varies across Python implementations, > and depends on the dictionary's history of insertions and deletions. > > http://docs.python.org/lib/types-set.html: append a new sentence to 2nd > paragraph > > Iteration over a set returns elements in an arbitrary order, > which may depend on the memory location of the elements.
It's possible there are other factors that can affect this as well. A more general statement is probably more appropriate: "Keys and values are listed in an arbitrary order. This order is non-random, varies across Python implementations, and depends on the dictionary's history of insertions and deletions as well as factors outside the scope of the containing program." "Iteration over a set returns elements in an arbitrary order, which may depend on factors outside the scope of the containing program." --- -Bill Hamilton -- http://mail.python.org/mailman/listinfo/python-list