Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33990
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; '[],': 0.07; 'false,': 0.07; 'problem?': 0.07; 'happen.': 0.09; '{},': 0.09; 'def': 0.10; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'possible?': 0.16; 'reproduce': 0.16; 'subject:questions': 0.16; 'wrote:': 0.17; "haven't": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'piece': 0.29; 'prints': 0.29; 'received:192.168.1.3': 0.29; 'skip:_ 10': 0.29; 'van': 0.29; 'maybe': 0.29; 'figure': 0.30; 'code': 0.31; 'problem.': 0.32; 'could': 0.32; 'print': 0.32; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'hi,': 0.33; 'something': 0.35; 'but': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'strange': 0.62; 'provide': 0.62; 'different': 0.63; 'results': 0.65; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'reply-to:addr:python.org': 0.84; 'obvious,': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=TdYURGsh c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=O2Kvzccb_dQA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=szZsM8mp6U8A:10 a=b4SmyxUErFPACx3GUhIA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Wed, 28 Nov 2012 00:59:13 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: deepcopy questions |
| References | <bbed43a4-457d-45c3-bc84-519d51516431@googlegroups.com> |
| In-Reply-To | <bbed43a4-457d-45c3-bc84-519d51516431@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.325.1354064354.29569.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1354064354 news.xs4all.nl 6960 [2001:888:2000:d::a6]:41851 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33990 |
Show key headers only | View raw
On 2012-11-27 23:59, lars van gemerden wrote:
> Hi,
>
> I get a very strange result when using deepcopy. The following code:
>
> def __deepcopy__(self, memo):
> independent = self.independent()
> if independent is self:
> out = type(self)()
> out.__dict__ = copy.deepcopy(self.__dict__, memo)
> print self.__dict__
> print out.__dict__ #strange result
> return out
> else:
> return copy.deepcopy(independent, memo).find(self.id).take()
>
> prints different results for self.__dict__ and out.__dict__:
>
> {'_active_': False, 'init': {}, '_id_': 0, '_items_': [<flow.library.collector object at 0x03893910>], '_name_': 'main'}
> {'_active_': False, 'init': {}, '_id_': 0}
>
> Two items are missing in the copy. Maybe i am missing something obvious, but i cannot figure out how this could happen.
>
> Can anyone tell me how this is possible?
>
I haven't been able to reproduce the problem.
Could you provide a self-contained and _runnable_ piece of code that
shows the problem?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
deepcopy questions lars van gemerden <lars@rational-it.com> - 2012-11-27 15:59 -0800
Re: deepcopy questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-28 00:46 +0000
Re: deepcopy questions MRAB <python@mrabarnett.plus.com> - 2012-11-28 00:59 +0000
Re: deepcopy questions lars van gemerden <lars@rational-it.com> - 2012-11-28 01:05 -0800
Re: deepcopy questions Dieter Maurer <dieter@handshake.de> - 2012-11-29 08:01 +0100
csiph-web