On Thu, 09 Feb 2012 09:35:52 -0700, Ian Kelly wrote: > On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice > <nathan.alexander.r...@gmail.com> wrote: >> As I said, two dictionaries created from the same input will be the >> same... > > That's an implementation detail, not a guarantee. It will hold for > current versions of CPython but not necessarily for other Python > implementations.
That day may be sooner than you think. It is very likely that in Python 3.3, dict order will be randomized on creation as a side-effect of adding a random salt to hashes to prevent a serious vulnerability in dicts. http://securitytracker.com/id/1026478 http://bugs.python.org/issue13703 If there is anyone still assuming that dicts have a predictable order, they're going to be in for a nasty surprise one of these days. -- Steven -- http://mail.python.org/mailman/listinfo/python-list