X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.muarf.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'schema': 0.05; 'classes.': 0.07; 'expressions': 0.07; 'json': 0.07; 'pypi': 0.07; 'forcing': 0.09; 'literal': 0.09; 'parsed': 0.09; 'subtle': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'wed,': 0.15; 'instead.': 0.15; 'output': 0.15; 'bonus.': 0.16; 'buffers,': 0.16; 'fits': 0.16; 'json,': 0.16; 'missing,': 0.16; 'new-style': 0.16; 'old-style': 0.16; 'outputs': 0.16; 'readable': 0.16; 'structure.': 0.16; 'subject:make': 0.16; 'trap.': 0.16; 'value.)': 0.16; 'write,': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'switched': 0.18; '>>>': 0.20; '(not': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'java': 0.22; 'subject:request': 0.22; 'am,': 0.23; 'bit': 0.23; '2015': 0.23; 'passing': 0.23; 'header:In-Reply-To:1': 0.24; 'properties': 0.24; 'chris': 0.26; 'points': 0.27; 'plain': 0.27; 'data,': 0.27; 'processed': 0.27; 'message-id:@mail.gmail.com': 0.28; 'subject:/': 0.29; 'accidentally': 0.29; 'buffers': 0.29; 'pickle': 0.29; 'becomes': 0.31; 'e.g.': 0.31; 'url:mailman': 0.31; 'code': 0.31; 'up.': 0.32; 'url:python': 0.33; 'received:google.com': 0.34; 'gives': 0.35; 'url:listinfo': 0.35; 'protocol': 0.35; 'returning': 0.35; 'something': 0.35; 'text': 0.36; 'too': 0.36; 'url:org': 0.36; 'there': 0.36; 'agree': 0.37; 'subject:: ': 0.37; 'tue,': 0.38; 'version': 0.38; 'stuff': 0.38; 'means': 0.39; 'pm,': 0.39; 'easily': 0.39; 'data': 0.40; 'easy': 0.60; 'field': 0.60; 'your': 0.60; 'default': 0.61; 'skip:u 10': 0.62; 'more': 0.62; 'safe': 0.63; 'within': 0.64; 'air': 0.65; 'sounds': 0.72; 'yourself': 0.73; 'lack': 0.76; 'chrisa': 0.84; 'dict,': 0.84; 'expressive': 0.84; 'kool-aid': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'canonical': 0.91; 'discipline': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+Jw4vZvVz0Wpjz8uh9aFelPqNrTmkd08+gIwlVbk3jQ=; b=b1QgFoUsmCOBsedCfFYRkDvaJ7f/jNBdQlm23RAMmFYZCZCni1ypjsFFQDZ+SGYAvO 5rY4xB1pu+k8TYxzTr0qVHFxvuDqAbzFBHKikZ69LQgrUv7OTuBE4M0P4uyzNQWo6fHY Tfhr7agjRypQ8MF3GTJK71RL1IH45mKRVsPYuFTQ/GZMZzxLIDcit+TAkOVcC9NrjIyt kgyOYHl6N+AyDg9lgBa7988NwE8XZPGV2n78g470IznjQm/XUow7k4jvL3QeNtX6mn62 e1blfDdjgWOaBJFr5rbXbCF0MUA/Io4W+w3U3h/SnJOHxmABgaWpHGbGW4lhFlaz+a+c DMug== X-Received: by 10.194.175.65 with SMTP id by1mr911973wjc.152.1433897314094; Tue, 09 Jun 2015 17:48:34 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <55778208$0$2899$e4fe514c@news2.news.xs4all.nl> References: <55778208$0$2899$e4fe514c@news2.news.xs4all.nl> From: Devin Jeanpierre Date: Tue, 9 Jun 2015 17:47:53 -0700 Subject: Re: enhancement request: make py3 read/write py2 pickle format To: Irmen de Jong Cc: "comp.lang.python" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433897321 news.xs4all.nl 2837 [2001:888:2000:d::a6]:52202 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92381 Passing around data that can be put into ast.literal_eval is synonymous with passing around data taht can be put into eval. It sounds like a trap. Other points against JSON / etc.: the lack of schema makes it easier to stuff anything in there (not as easily as pickle, mind), and by returning a plain dict, it becomes easier to require a field than to allow a field to be missing, which is bad for robustness and bad for data format migrations. (Protobuf (v3) has schemas and gives every field a default value.) For human readable serialized data, text format protocol buffers are seriously underrated. (Relatedly: underdocumented, too.) /me lifts head out of kool-aid and gasps for air -- Devin On Tue, Jun 9, 2015 at 5:17 PM, Irmen de Jong wrote: > On 10-6-2015 1:06, Chris Angelico wrote: >> On Wed, Jun 10, 2015 at 6:07 AM, Devin Jeanpierre >> wrote: >>> There's a lot of subtle issues with pickle compatibility. e.g. >>> old-style vs new-style classes. It's kinda hard and it's better to >>> give up. I definitely agree it's better to use something else instead. >>> For example, we switched to using protocol buffers, which have much >>> better compatibility properties and are a bit more testable to boot >>> (since text format protobufs are always output in a canonical (sorted) >>> form.) >> >> Or use JSON, if your data fits within that structure. It's easy to >> read and write, it's human-readable, and it's safe (no chance of >> arbitrary code execution). Forcing yourself to use a format that can >> basically be processed by ast.literal_eval() is a good discipline - >> means you don't accidentally save/load too much. >> >> ChrisA >> > > I made a specialized serializer for this, which is more expressive than JSON. It outputs > python literal expressions that can be directly parsed by ast.literal_eval(). You can > find it on pypi (https://pypi.python.org/pypi/serpent). It's the default serializer of > Pyro, and it includes a Java and .NET version as well as an added bonus. > > > Irmen > > > -- > https://mail.python.org/mailman/listinfo/python-list