Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!aioe.org!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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'method,': 0.07; '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; 'subclasses': 0.09; 'underlying': 0.09; 'am,': 0.14; 'extension': 0.14; 'wrote:': 0.14; 'enigma': 0.16; 'kern': 0.16; 'numpy': 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; 'interpret': 0.19; 'discussion': 0.20; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'correctly.': 0.25; 'pointed': 0.25; 'define': 0.26; 'all.': 0.30; 'arrays': 0.31; 'url:library': 0.31; 'to:addr:python-list': 0.32; 'url:docs': 0.33; 'header:X-Complaints-To:1': 0.34; 'header :User-Agent:1': 0.35; 'url:python': 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; 'to:addr:python.org': 0.39; 'header :Mime-Version:1': 0.39; 'except': 0.39; 'attempt': 0.40; 'would': 0.40; 'header:Received:5': 0.40; 'philip': 0.60; 'direct': 0.61; 'our': 0.63; 'world': 0.65; 'subject:. ': 0.66; 'believe': 0.66; 'eco': 0.84; 'hands,': 0.84; 'mechanism.': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: Multiprocessing, shared memory vs. pickled copies Date: Thu, 07 Apr 2011 12:44:05 -0500 Organization: The Church of Last Thursday References: <6ace38dc-33c6-44ab-a17a-084d62d666cb@w9g2000prg.googlegroups.com> <5d0fcd63-cebf-4b6e-a176-20cb7bbec389@n12g2000yqc.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: <5d0fcd63-cebf-4b6e-a176-20cb7bbec389@n12g2000yqc.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302198262 news.xs4all.nl 65870 [::ffff:82.94.164.166]:37006 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2790 On 4/7/11 1:40 AM, John Ladasky wrote: > On Apr 5, 10:43 am, Philip Semanchuk 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-unpickling-extension-types ndarrays are extension types, so they use that mechanism. -- 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