Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'json': 0.07; 'dict': 0.09; 'mess': 0.09; 'objects.': 0.09; 'received:internal': 0.09; 'python': 0.11; 'anyway': 0.11; 'example:': 0.11; 'wed,': 0.15; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'subject:make': 0.16; 'tcp': 0.16; "{'a':": 0.16; 'wrote:': 0.16; 'subject:request': 0.22; 'references': 0.23; 'header:In-Reply-To:1': 0.24; 'subject:/': 0.29; 'other,': 0.29; 'objects': 0.29; 'e.g.': 0.31; 'extend': 0.31; "can't": 0.32; 'skip:d 20': 0.32; 'open': 0.33; 'to:addr :python-list': 0.35; 'tools,': 0.36; 'received:10': 0.37; 'subject:: ': 0.37; '(with': 0.38; 'received:66': 0.38; 'files': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'maximum': 0.61; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.62; 'leading': 0.62; 'exceed': 0.66; 'subject:read': 0.84; 'subject:write': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=zTlx/DqM2KfHJuwcZZ24gY1HfbM=; b=p3D1eb prfXwLXHzQyVjL9qzwZEzTrxXrS1qxYxANOT+KivJ4xe47ZjNlklO9Gkick5dODy Kgc33yvvTgybtxbEDzjLDH2QxmEOQujWXGlrx052CBrIzudlwMppz62Vih1iob+R 571gBKWg5D7mZNi66B8AHfve59CFYzHoS9ezs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=zTlx/DqM2KfHJuw cZZ24gY1HfbM=; b=NeZS/OYOSDU4VK7nbhxikXoyH0BJ0fAaWBLduc2dlJXeXS6 +ktN8/xn/2/jmWZ+d54Zqtog56zzviIqnK2crhirZ+z7Tu3UuhDNYgUvtmTeWWhZ MDI73EXhl1+UB+hfHPtaVFJ6San324W6h09GyR4Hh/aE6YziuF0LG+A3Y22Q= X-Sasl-Enc: bSsqVJxUBkM3ucC0cUyx4EIk2kEEbEaj4vUiNYh6UY4R 1433943519 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-ff004c4b In-Reply-To: <878ubr3gv8.fsf@elektro.pacujo.net> References: <878ubr3gv8.fsf@elektro.pacujo.net> Subject: Re: enhancement request: make py3 read/write py2 pickle format Date: Wed, 10 Jun 2015 09:38:39 -0400 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433943523 news.xs4all.nl 2830 [2001:888:2000:d::a6]:47712 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92398 On Wed, Jun 10, 2015, at 08:08, Marko Rauhamaa wrote: > You can't serialize/migrate arbitrary objects. Consider open TCP > connections, open files and other objects that extend outside the Python > VM. Also objects hold references to each other, leading to a huge > reference mesh. > > For example: > > a.buddy = b > b.buddy = a > with open("a", "wb") as f: f.write(serialize(a)) > with open("b", "wb") as f: f.write(serialize(b)) > > with open("a", "rb") as f: aa = deserialize(f.read()) > with open("b", "rb") as f: bb = deserialize(f.read()) > assert aa.buddy is bb Of course, if you serialize a single dict with e.g. {'a': a, 'b': b}, you can expect (with advanced serialization tools, anyway - I suspect JSON will just make a mess or exceed maximum recursion depth) result['a'].buddy is result['b']