meanburrito920
April 22nd, 2008, 01:16 AM
my code runs something like the following:
a_list = [0,0]
list_of = []
while True:
#do something to a_list here
list_of.append(l)
the problem is that since I am appending a_list to list_of, it thinks that every time a_list changes it should change all previous versions of a_list to the current value of a_list, so at the end of the loop list_of ends up being a list of 'a_list's that is x 'a_lists's long. I want it to forget the reference to l after it is appended and simply store the values, but I'm not exactly sure how to go about this. Any suggestions?
a_list = [0,0]
list_of = []
while True:
#do something to a_list here
list_of.append(l)
the problem is that since I am appending a_list to list_of, it thinks that every time a_list changes it should change all previous versions of a_list to the current value of a_list, so at the end of the loop list_of ends up being a list of 'a_list's that is x 'a_lists's long. I want it to forget the reference to l after it is appended and simply store the values, but I'm not exactly sure how to go about this. Any suggestions?