On Tue, Aug 9, 2011 at 1:23 AM, Terry Reedy <tjre...@udel.edu> wrote: > I have no idea how stable and local pickles are, but I know they were not > designed for diff-ing. Json or yaml representations might do better if > applicable. >
In terms of stability, you'd probably have to have a rule that dictionaries are sorted by their keys before being encoded. Currently I can think of only one spec that requires that, and that's the .torrent file definition (it's mandated so that the info hash is stable). It may be necessary to build your own encoder routine to enforce this; you could still use a standard format, which will mean that a standard decoder will work fine. Depending on what you're doing, though, it might well be easier to abandon the entire notion of pickling an object and sending it, and instead send higher-level conceptual data. I've always been a bit leery of systems that let you "send an object" from one computer to another, because they're so easily misused; instead of sending the data that's needed at the other end, an entire complex object is sent, and the far end extracts the data it wants. Not only does a ridiculous amount of unnecessary data get encoded, transmitted, and decoded, but sometimes it can have security implications (such as a certain multiplayer game that reveals to any player the identities of all other players, including their login email addresses and IP addresses). ChrisA -- http://mail.python.org/mailman/listinfo/python-list