Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:object': 0.07; 'python': 0.08; 'encoder': 0.09; 'binary': 0.13; "hasn't": 0.13; 'subject:file': 0.13; 'thanks!': 0.14; 'received:172.18.0': 0.16; 'unordered': 0.16; 'wrote:': 0.16; 'subject:skip:s 10': 0.18; 'help.': 0.18; 'jan': 0.19; 'suggest': 0.20; 'header:In-Reply- To:1': 0.22; 'objects,': 0.23; 'received:213.165': 0.24; 'developing': 0.25; 'module': 0.26; 'pm,': 0.26; 'url:mailman': 0.26; 'load': 0.26; "i'm": 0.27; 'problem': 0.29; 'efficiently': 0.30; 'far,': 0.30; 'url:listinfo': 0.30; '(e.g.': 0.30; 'url:library': 0.30; 'app': 0.31; 'version': 0.31; "isn't": 0.32; 'to:addr:python-list': 0.33; 'there': 0.33; 'force': 0.34; 'mostly': 0.34; 'anything': 0.34; 'flag': 0.34; 'numbers.': 0.34; 'stores': 0.34; 'from:charset:iso-8859-1': 0.34; 'probably': 0.35; 'subject:text': 0.35; 'file': 0.35; 'url:python': 0.36; 'header:Received:8': 0.36; 'but': 0.37; 'easiest': 0.38; 'created': 0.38; 'possible.': 0.39; 'url:docs': 0.39; "i'd": 0.39; 'url:org': 0.39; 'subject:: ': 0.39; 'change': 0.40; 'might': 0.40; 'to:addr:python.org': 0.40; 'data': 0.40; 'course,': 0.61; 'kind': 0.62; 'header:Message-Id:1': 0.62; 'texts': 0.73; 'database.': 0.74; 'received:(helo localhost)': 0.77; '2012,': 0.84; 'dict,': 0.84; 'otten': 0.84; 'received:hu': 0.93 X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) at allied-visions.de Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1251.1) Subject: Re: stable object serialization to text file From: =?iso-8859-1?Q?M=E1t=E9_Koch?= In-Reply-To: Date: Thu, 12 Jan 2012 14:32:19 +0100 Content-Transfer-Encoding: quoted-printable References: <030AD516-2A52-411B-9A20-BD60DF8AE75B@me.com> To: python-list@python.org X-Mailer: Apple Mail (2.1251.1) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326375153 news.xs4all.nl 6900 [2001:888:2000:d::a6]:43611 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18875 That's probably the easiest way as I don't store any binary data just = strings and numbers. Thanks! On Jan 12, 2012, at 1:24 PM, Peter Otten wrote: > M=E1t=E9 Koch wrote: >=20 >> I'm developing an app which stores the data in file system database. = The >> data in my case consists of large python objects, mostly dicts, = containing >> texts and numbers. The easiest way to dump and load them would be = pickle, >> but I have a problem with it: I want to keep the data in version = control, >> and I would like to use it as efficiently as possible. Is it possible = to >> force pickle to store the otherwise unordered (e.g. dictionary) data = in a >> kind of ordered way, so that if I dump a large dict, then change 1 = tiny >> thing in it and dump again, the diff of the former and the new file = will >> be minimal? >>=20 >> If pickle is not the best choice for me, can you suggest anything = else? >> (If there isn't any solution for it so far, I will write the module = of >> course, but first I'd like to look around and make sure it hasn't = been >> created yet.) >=20 > Have you considered json?=20 >=20 > http://docs.python.org/library/json.html >=20 > The encoder features a sort_keys flag which might help. >=20 > --=20 > http://mail.python.org/mailman/listinfo/python-list