[issue16498] Unwanted link between volatile and shelve storage

2012-11-18 Thread Terry Cooper

New submission from Terry Cooper:

The Python statement gList1[i1][1] += gList2[i2][1] modifies not only gList1 (a 
volatile storage object) but dBasis[163] (a record within shelve object 
dBasis).  Both gList and dBasis[163] are printed before and after execution of 
the statement by cFract2.combine.  They are obviously not the same record, but 
the statement modifies gList1[2][1] and dBasis[163][2][1] simultaniously.

--
components: Windows
files: bugMail.py
messages: 175871
nosy: ttcooper
priority: normal
severity: normal
status: open
title: Unwanted link between volatile and shelve storage
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file28023/bugMail.py

___
Python tracker 
<http://bugs.python.org/issue16498>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16498] Unwanted link between volatile and shelve storage

2012-11-18 Thread Terry Cooper

Terry Cooper added the comment:

This is easy to reply to.  You better believe I've tried printing gList1 and 
dBasis[163].  I've also scrapped a predecessor function named combo (which is 
included in the attachment) and written its successor, viz., "combine".  I bent 
over backwards to make sure that the two functions did NOTHING the same way.  
Guess what.  Both combo and combine screw up exactly the same record that they 
aren't supposed to know about in exactly the same way.  So I'm pretty sure 
Python remembers that it originally got one ITEM on gList from dBasis[161].  So 
I think I know that the problem is to determine WHY Python remembers that.  Of 
course what oneo thinks one knows is always subject to revision--especially 
what one thinks one knows about the truth.

--Terry

-Original Message-
>From: Ezio Melotti 
>Sent: Nov 18, 2012 2:07 PM
>To: ttcoo...@indy.net
>Subject: [issue16498] Unwanted link between volatile and shelve storage
>
>
>Ezio Melotti added the comment:
>
>> They are obviously not the same record
>
>Have you tried printing gList1 and dBasis[163], their repr and their ids?
>
>--
>nosy: +ezio.melotti
>
>___
>Python tracker 
><http://bugs.python.org/issue16498>
>___

--

___
Python tracker 
<http://bugs.python.org/issue16498>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16498] Unwanted link between volatile and shelve storage

2012-11-18 Thread Terry Cooper

Terry Cooper added the comment:

Got your message before I got his.  Thanks for the reference to python-list.

-Original Message-
>From: "R. David Murray" 
>Sent: Nov 18, 2012 9:39 PM
>To: ttcoo...@indy.net
>Subject: [issue16498] Unwanted link between volatile and shelve storage
>
>
>R. David Murray added the comment:
>
>If it "got it" from dBasis[163] via item assignment (say gList1[i1][1] = 
>dBasis[163]), then yes, Python remembers that.  Names just hold pointers to 
>objects, so after that assignment gList1[i1][1] points to the same object as 
>dBasis[163] does.  If that object is mutable, and you mutate it (as += will 
>do, if the object is mutable), both names will still reference the same 
>object, the one that has been changed.  
>
>As Serhiy suggested, you are more likely to get help with this on python-list.
>
>--
>
>___
>Python tracker 
><http://bugs.python.org/issue16498>
>___

--

___
Python tracker 
<http://bugs.python.org/issue16498>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com