Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35655

Re: pickle module doens't work

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'referring': 0.07; 'python': 0.09; 'docs.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'terry': 0.09; 'language': 0.14; 'java,': 0.15; 'importable': 0.16; 'itself).': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'similarly,': 0.16; 'stored.': 0.16; 'wrote:': 0.17; 'fix': 0.17; '2.2': 0.17; 'instance': 0.17; 'jan': 0.18; 'load': 0.19; 'module': 0.19; 'code.': 0.20; 'written': 0.20; 'earlier': 0.21; 'class.': 0.23; 'machine': 0.24; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'bugs': 0.27; 'compiled': 0.27; 'header:X-Complaints-To:1': 0.28; 'pickle': 0.29; 'definition': 0.29; 'objects': 0.29; 'probably': 0.29; 'class': 0.29; 'classes': 0.30; "skip:' 10": 0.30; 'code': 0.31; 'point': 0.31; 'url:python': 0.32; 'instances': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'done': 0.34; 'along': 0.35; 'add': 0.36; 'received:org': 0.36; 'created': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'should': 0.36; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'save': 0.61; 'restore': 0.69; "'class'": 0.84; 'pickled': 0.84; 'received:fios.verizon.net': 0.84; 'angel': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: pickle module doens't work
Date Thu, 27 Dec 2012 16:19:42 -0500
References <ee10f0f7-7713-4879-82a1-ec5804767af6@googlegroups.com> <mailman.1339.1356607732.29569.python-list@python.org> <f6ea95c2-2448-4f93-8aa4-e4e2aeb731ba@googlegroups.com> <50DC4043.3060606@davea.name>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <50DC4043.3060606@davea.name>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1370.1356643212.29569.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356643212 news.xs4all.nl 6909 [2001:888:2000:d::a6]:58438
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35655

Show key headers only | View raw


On 12/27/2012 7:34 AM, Dave Angel wrote:

> Perhaps you'd rather see it in the Python docs.
>
> http://docs.python.org/2/library/pickle.html
> http://docs.python.org/3.3/library/pickle.html
>
> pickle <http://docs.python.org/2/library/pickle.html#module-pickle>can
> save and restore class instances transparently, however the class
> definition must be importable and live in the same module as when the
> object was stored.
> and
> Similarly, when class instances are pickled, their class’s code and data
> are not pickled along with them. Only the instance data are pickled.
> This is done on purpose, so you can fix bugs in a class or add methods
> to the class and still load objects that were created with an earlier
> version of the class.

I should point out the the above was probably written before the 
(partial) unification of types and classes in 2.2 (completed in 3.3). So 
'class' is referring to 'Python-coded class' and 'code' is referring to 
'(compiled) Python code', and not machine code. Now, everything that 
pickle pickles is a 'class instance' and class code can be compiled from 
either Python or the interpreter's system language (C, Java, C#, others, 
or even Python itself).

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 02:46 -0800
  Re: pickle module doens't work Peter Otten <__peter__@web.de> - 2012-12-27 12:29 +0100
    Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 04:05 -0800
      Re: pickle module doens't work Dave Angel <d@davea.name> - 2012-12-27 07:34 -0500
        Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 05:16 -0800
          Re: pickle module doens't work Chris Angelico <rosuav@gmail.com> - 2012-12-28 00:20 +1100
        Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 05:16 -0800
          Re: pickle module doens't work Tim Roberts <timr@probo.com> - 2012-12-28 21:41 -0800
            Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2013-01-01 06:33 -0800
              Re: pickle module doens't work Tim Roberts <timr@probo.com> - 2013-01-01 11:14 -0800
                Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2013-01-02 06:08 -0800
      Re: pickle module doens't work Terry Reedy <tjreedy@udel.edu> - 2012-12-27 16:19 -0500
    Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 04:05 -0800

csiph-web