This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: named kwd form of OrderedDict ctor yield random key order
Type: Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, rhettinger, yop
Priority: normal Keywords:

Created on 2012-11-25 20:38 by yop, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg176387 - (view) Author: yop (yop) Date: 2012-11-25 20:38
tested on 2.7.3 with -R or stock 3.3, the following:

OrderedDict(foo=0,bar=0).keys()

is nondeterminstic as a result of hash randomization. 
probably since **kwds creates a dict.

what is the proper idiom for constructing an ordered-key
dictionary other then (ugly, verbose) piecemeal insertion?
msg176388 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-11-25 20:41
It's random anyway, since keyword arguments have no order.

You can use a tuple.
History
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60757
2012-11-25 20:41:27benjamin.petersonsetstatus: open -> closed
resolution: not a bug
2012-11-25 20:41:19benjamin.petersonsetmessages: + msg176388
2012-11-25 20:38:07yopcreate