[Python-Dev] Changing the order of iteration over a dictionary

Fred Drake fdrake at acm.org
Fri Jan 20 12:11:47 CET 2012


On Fri, Jan 20, 2012 at 5:49 AM, Mark Shannon <mark at hotpy.org> wrote:
> So, don't be afraid to change that hash function :)

Definitely.

The hash function *has* been changed in the past, and a lot of developers
were schooled in not relying on the iteration order.  That's a good thing,
as those developers now write tests of what's actually important rather
than relying on implementation details of the Python runtime.

A hash function that changes more often than during an occasional major
version update will encourage more developers to write better tests.  We
can think of it as an educational tool.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at acm.org>
"A person who won't read has no advantage over one who can't read."
   --Samuel Langhorne Clemens


More information about the Python-Dev mailing list