Re: Need to pass Object by value into a list

2005-09-26 Thread Bruno Desthuilliers
Aaron a écrit : > I have a data sructure setup and I populate it in a loop like so: > > y=0 > while X: >DS.name = "ASDF" >DS.ID = 1234 >list[y] = DS; >y = y + 1 > > print list Traceback (most recent call last): File "", line 1, in ? File "/usr/tmp/python-9150sSF", line 2,

Re: Need to pass Object by value into a list

2005-09-26 Thread Fredrik Lundh
Aaron wrote: > I have a data sructure setup and I populate it in a loop like so: > > y=0 > while X: >DS.name = "ASDF" >DS.ID = 1234 > >list[y] = DS; >y = y + 1 > > print list > > This does not work because DS is passed in by reference causing all > entries into the list to change t

Need to pass Object by value into a list

2005-09-26 Thread Aaron
I have a data sructure setup and I populate it in a loop like so: y=0 while X: DS.name = "ASDF" DS.ID = 1234 list[y] = DS; y = y + 1 print list This does not work because DS is passed in by reference causing all entries into the list to change to the most current value. I cannot fi