Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2806
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'method,': 0.07; 'type,': 0.07; 'python': 0.07; '>>>>': 0.09; 'not?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subclass': 0.09; 'subclasses': 0.09; 'underlying': 0.09; 'pm,': 0.11; '>>>': 0.12; 'am,': 0.14; 'extension': 0.14; 'wrote:': 0.14; '.py': 0.16; 'enigma': 0.16; 'kern': 0.16; 'numpy': 0.16; 'really.': 0.16; 'received:216.62': 0.16; 'received:216.62.213': 0.16; 'received:enthought.com': 0.16; 'semanchuk': 0.16; 'subclasses,': 0.16; 'subject:memory': 0.16; 'subject:vs.': 0.16; "we'd": 0.16; 'thanks,': 0.17; 'interpret': 0.19; 'level,': 0.19; 'object,': 0.19; 'yet.': 0.19; 'discussion': 0.20; 'code': 0.22; 'header:In- Reply-To:1': 0.22; 'posted': 0.22; "haven't": 0.23; 'example.': 0.23; 'issue,': 0.23; 'issues.': 0.23; 'least,': 0.23; 'correctly.': 0.25; 'pointed': 0.25; 'define': 0.26; 'object': 0.27; 'definition': 0.29; 'probably': 0.30; 'all.': 0.30; 'arrays': 0.31; 'types.': 0.31; 'yes.': 0.31; 'determine': 0.31; 'url:library': 0.31; 'perhaps': 0.32; 'to:addr:python-list': 0.32; 'source': 0.32; 'url:docs': 0.33; 'things': 0.33; 'header:X -Complaints-To:1': 0.34; 'actually': 0.34; 'got': 0.34; 'there': 0.35; 'files,': 0.35; 'header:User-Agent:1': 0.35; 'examine': 0.35; 'list.': 0.35; 'shows': 0.36; 'should': 0.37; 'url:python': 0.37; 'issue': 0.37; 'run': 0.37; 'apr': 0.38; 'but': 0.38; 'url:org': 0.38; 'received:org': 0.38; 'though': 0.38; 'not,': 0.39; 'ok,': 0.39; 'mailing': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'how': 0.39; 'except': 0.39; 'attempt': 0.40; 'would': 0.40; "it's": 0.40; 'header:Received:5': 0.40; 'philip': 0.60; 'shortly': 0.60; 'skip:n 30': 0.60; 'direct': 0.61; 'our': 0.63; 'world': 0.65; 'subject:. ': 0.66; 'believe': 0.66; '10:44': 0.84; 'eco': 0.84; 'hands,': 0.84; 'mechanism.': 0.84; 'seriously,': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Multiprocessing, shared memory vs. pickled copies |
| Date | Thu, 07 Apr 2011 15:01:18 -0500 |
| Organization | The Church of Last Thursday |
| References | <6ace38dc-33c6-44ab-a17a-084d62d666cb@w9g2000prg.googlegroups.com> <mailman.27.1301960081.9059.python-list@python.org> <cad2405b-378c-43e4-b79e-edf81e5701e2@w7g2000pre.googlegroups.com> <mailman.56.1302026842.9059.python-list@python.org> <5d0fcd63-cebf-4b6e-a176-20cb7bbec389@n12g2000yqc.googlegroups.com> <mailman.115.1302198262.9059.python-list@python.org> <df11f2e9-19e7-4713-a933-aa6161f8bb5d@p16g2000yqb.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | outbound.enthought.com |
| User-Agent | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
| In-Reply-To | <df11f2e9-19e7-4713-a933-aa6161f8bb5d@p16g2000yqb.googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.122.1302206509.9059.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1302206509 news.xs4all.nl 32470 [::ffff:82.94.164.166]:33273 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2806 |
Show key headers only | View raw
On 4/7/11 1:39 PM, John Ladasky wrote: > On Apr 7, 10:44 am, Robert Kern<robert.k...@gmail.com> wrote: >> On 4/7/11 1:40 AM, John Ladasky wrote: >> >>> On Apr 5, 10:43 am, Philip Semanchuk<phi...@semanchuk.com> wrote: >>>> And as Robert Kern pointed out, numpy arrays are also pickle-able. >> >>> OK, but SUBCLASSES of numpy.ndarray are not, in my hands, pickling as >>> I would expect. I already have lots of code that is based on such >>> subclasses, and they do everything I want EXCEPT pickle correctly. I >>> may have to direct this line of questions to the numpy discussion >>> group after all. >> >> Define the __reduce_ex__() method, not __getstate__(), __setstate__(). >> >> http://docs.python.org/release/2.6.6/library/pickle.html#pickling-and... >> >> ndarrays are extension types, so they use that mechanism. > > Thanks, Robert, as you can see, I got on that track shortly after I > posted my code example. This is apparently NOT a numpy issue, it's an > issue for pickling all C extension types. Yes, but seriously, you should ask on the numpy mailing list. You will probably run into more numpy-specific issues. At least, we'd have been able to tell you things like "ndarray is an extension type, so look at that part of the documentation" quicker. > Is there a way to examine a Python object, and determine whether it's > a C extension type or not? For sure? No, not really. Not at the Python level, at least. You may be able to do something at the C level, I don't know. > Or do you have to deduce that from the > documentation and/or the source code? > > I started hunting through the numpy source code last night. It's > complicated. I haven't found the ndarray object definition yet. > Perhaps because I was looking through .py files, when I actually > should have been looking through .c files? Yes. The implementation for __reduce__ is in numpy/core/src/multiarray/methods.c as array_reduce(). You may want to look in numpy/ma/core.py for the definition of MaskedArray. It shows how you would define __reduce__, __getstate__ and __setstate__ for a subclass of ndarray. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-04 13:20 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-04 19:34 -0400
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-05 09:58 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-05 13:43 -0400
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-06 23:40 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-07 00:41 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-07 09:23 -0400
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-07 12:44 -0500
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-07 11:39 -0700
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-07 15:01 -0500
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-04 19:05 -0500
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 16:39 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-04 21:16 -0400
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-05 10:47 -0500
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 17:03 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 17:38 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 18:10 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-09 00:36 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-09 10:15 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-09 13:18 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-10 08:01 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-10 15:35 -0700
csiph-web