"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
> >
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[:] (
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
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
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 int
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[:] (
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, b
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 poi
"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 pro
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
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 o
11 matches
Mail list logo