Message219891
Yes but the input is turned into a dict, and dicts do not preserve order. Further, what is passed to the object_hook is already a dict, so the order is already lost before object_hook is called.
Since the parser (or at least the Python version of the parser) first turns the input into a list of pairs, and a Python OrderedDict can be instantiated from a list of pairs, it would theoretically be possible to extend the object_hook API to allow an OrderedDict to be used on decode. Exactly how to do that so as to retain backward compatibility is a bit of a question.
So, it is *possible* to achieve your aim, but it isn't as simple as allowing sort= to be set False.
IMO being able to preserve the order of the input when desired (ie: use an OrderedDict object_hook) would be a nice feature to have. |
|
Date |
User |
Action |
Args |
2014-06-06 16:44:19 | r.david.murray | set | recipients:
+ r.david.murray, rhettinger, pitrou, ezio.melotti, berker.peksag, Pavel.Kazlou |
2014-06-06 16:44:19 | r.david.murray | set | messageid: <1402073059.92.0.726915742337.issue21650@psf.upfronthosting.co.za> |
2014-06-06 16:44:19 | r.david.murray | link | issue21650 messages |
2014-06-06 16:44:19 | r.david.murray | create | |
|