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.

Author rhettinger
Recipients bob.ippolito, rhettinger
Date 2009-02-27.19:59:10
SpamBayes Score 9.973506e-10
Marked as misclassified No
Message-id <1235764753.78.0.473123474274.issue5381@psf.upfronthosting.co.za>
In-reply-to
Content
Same reason as for config files and yaml files.  Sometimes those files
represent human edited input and if a machine re-edits, filters, or
copies, it is nice to keep the original order (though it may make no
semantic difference to the computer).  

For example, jsonrpc method invocations are done with objects having
three properties (method, params, id).  The machine doesn't care about
the order of the properties but a human reader prefers the order listed:

  --> {"method": "postMessage", "params": ["Hello all!"], "id": 99}
  <-- {"result": 1, "error": null, "id": 99}

If you're testing a program that filters json data (like a typical xml
task), it is nice to write-out data in the same order received (failing
to do that is a common complaint about misdesigned xml filters):

  --> {{"title": "awk", "author":"aho", "isbn":"123456789X"},
       {"title": "taocp", "author":"knuth", "isbn":"987654321X"}"
  <-- {{"title": "awk", "author":"aho"},
       {"title": "taocp", "author":"knuth"}}
       
Semantically, those entries can be scrambled; however, someone reading
the filtered result desires that the input and output visually
correspond as much as possible.  An object_pairs_hook makes this possible.
History
Date User Action Args
2009-02-27 19:59:13rhettingersetrecipients: + rhettinger, bob.ippolito
2009-02-27 19:59:13rhettingersetmessageid: <1235764753.78.0.473123474274.issue5381@psf.upfronthosting.co.za>
2009-02-27 19:59:12rhettingerlinkissue5381 messages
2009-02-27 19:59:10rhettingercreate