[New-bugs-announce] [issue6105] json.dumps doesn't respect OrderedDict's iteration order
Wang Chun
report at bugs.python.org
Mon May 25 11:22:46 CEST 2009
New submission from Wang Chun <yaohua2000 at 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 <report at bugs.python.org>
<http://bugs.python.org/issue6105>
_______________________________________
More information about the New-bugs-announce
mailing list