Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52807
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fredrik@dolda2000.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:modules': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; '(which,': 0.16; 'obviously,': 0.16; 'overridden': 0.16; 'overriding': 0.16; 'subclasses': 0.16; 'subclassing': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'trying': 0.19; 'normally': 0.19; 'work,': 0.20; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; "aren't": 0.24; 'certainly': 0.24; 'module,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'along': 0.30; "i'm": 0.30; 'another.': 0.31; 'assumes': 0.31; 'pickle': 0.31; 'class': 0.32; 'interface': 0.32; 'guess': 0.33; 'skip:_ 10': 0.34; 'maybe': 0.34; "i'd": 0.34; 'subject:from': 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'add': 0.35; 'found.': 0.36; 'subject:data': 0.36; 'charset:us-ascii': 0.36; 'expected': 0.38; 'rather': 0.38; 'skip:u 10': 0.60; 'such': 0.63; 'within': 0.65; 'believe': 0.68; 'normal.': 0.68; 'behavior': 0.77; '2013,': 0.91 |
| Date | Thu, 22 Aug 2013 05:05:01 +0200 (CEST) |
| From | Fredrik Tolf <fredrik@dolda2000.com> |
| To | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
| Subject | RE: Unpickling data with classes from dynamic modules |
| In-Reply-To | <5B80DD153D7D744689F57F4FB69AF4741867F701@SCACMX008.exchad.jpmchase.net> |
| References | <alpine.DEB.2.10.1308211732440.18360@shack.dolda2000.com> <5B80DD153D7D744689F57F4FB69AF4741867F701@SCACMX008.exchad.jpmchase.net> |
| User-Agent | Alpine 2.10 (DEB 1266 2009-07-14) |
| MIME-Version | 1.0 |
| Content-Type | TEXT/PLAIN; charset=US-ASCII; format=flowed |
| X-Greylist | Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.3.7 (nerv.dolda2000.com [IPv6:2002:54d9:e26d:200::1]); Thu, 22 Aug 2013 05:05:02 +0200 (CEST) |
| Cc | "python-list@python.org" <python-list@python.org> |
| 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.116.1377140706.19984.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377140706 news.xs4all.nl 15911 [2001:888:2000:d::a6]:39217 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52807 |
Show key headers only | View raw
On Wed, 21 Aug 2013, Prasad, Ramit wrote: > Fredrik Tolf wrote: >> [...] >> I considered trying to create subclasses of the pickler and unpickler that >> pickle a reference to a module loader and data for the particular module >> along with a class that comes from such a module, by overriding >> Pickler.save_global and Unpickler.load_global. Unfortunately, however, >> those functions aren't part of the public interface and can't be >> overridden when the C-pickle module is used instead (which, obviously, is >> what normally happens). >> [...] > > I believe rather than subclassing the pickler, you are expected to > change the behavior from within the class via __getstate__ and __setstate__. Well, that clearly wouldn't work, since that still assumes the module can be found. > Maybe all you need to add is implementation for obj.__reduce__ That would certainly work, and I guess I could perhaps use it as a work-around, but that would mean I'd have to mark every single such class as such in some way or another. What I'm looking for is a solution that could make them picklable transparently, just like normal. -- Fredrik Tolf
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: Unpickling data with classes from dynamic modules Fredrik Tolf <fredrik@dolda2000.com> - 2013-08-22 05:05 +0200
csiph-web