New submission from Wang Chun <yaohua2...@gmail.com>: PEP-0372 and Issue 5381 both say json.dumps respect OrderedDict's iteration order, but the example in them do not work on my latest trunk build.
$ uname -a Linux 12.38 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux $ python2.7 Python 2.7a0 (trunk, May 21 2009, 08:00:00) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import json >>> from collections import OrderedDict >>> items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)] >>> json.dumps(OrderedDict(items)) '{"four": 4, "three": 3, "five": 5, "two": 2, "one": 1}' ---------- components: Library (Lib) messages: 88311 nosy: wangchun severity: normal status: open title: json.dumps doesn't respect OrderedDict's iteration order versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com