Fredrik Lundh [EMAIL PROTECTED] wrote:
Steve Holden wrote:
One of the fascinating things about c.l.py is that sometimes a questin
will be posted that makes almost no sense to me, and somebody else will
casually read the OP's mind, home in on the issue and provide a useful
and relevant
I think what you mean is that if you change your list, it is changed
somewhere in your dicrionary to. Lists are always copied as pointers,
except explicitly told other wise. So a = b = [] makes a and be the
same list, and a.append(1) makes b - [1].
So do something like mydict[mykey] = mylist[:]
John Machin wrote:
Ben wrote:
Hello...
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...
It would appear that what I am dumping into the
Steve Holden wrote:
One of the fascinating things about c.l.py is that sometimes a questin
will be posted that makes almost no sense to me, and somebody else will
casually read the OP's mind, home in on the issue and provide a useful
and relevant answer.
if the assertions made by some
Steve Holden wrote:
John Machin wrote:
Ben wrote:
Hello...
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...
It would appear that what I
Hello...
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...
It would appear that what I am dumping into the dictionary value is
only a pointer to the
Ben wrote:
Hello...
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...
It would appear that what I am dumping into the dictionary value is
only
Ben [EMAIL PROTECTED] writes:
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values,
then dumping this list into the dictionary. Or so I thought...
Our crystal balls are notoriously unreliable for viewing program
Ben wrote:
I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...
It would appear that what I am dumping into the dictionary value is
only a pointer
On 6 Oct 2006 14:37:59 -0700, Ben [EMAIL PROTECTED] wrote:
Is there a way to acheive what I was attempting ? I have done something
almost identical with classes in a list before, and in that case a new
instance was created for each list entry...
Not sure what you're trying to pull off, but
I think what you mean is that if you change your list, it is changed
somewhere in your dicrionary to. Lists are always copied as pointers,
except explicitly told other wise. So a = b = [] makes a and be the
same list, and a.append(1) makes b - [1].
So do something like mydict[mykey] = mylist[:]
11 matches
Mail list logo