[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] Variables linking to eachother
I have had this problem a few times.
When I assign a variable, sometimes they 'link' to eachother eg
x = 1
y = x
x = 2
print y
2
In this example of what is the problem is, however this example works.
I had the problem when duplicating an item in a list.
platformList.insert(1, platformList[selectedPlatform]) # This had problems, both items linked togather and I could not change one part of the list item without the other changing too.
However turning the list item into a string and eval()'ing it worked without the linking problem.
platformList.insert(1, eval( str(platformList[selectedPlatform])))
Does anyone know what is going on, how to get around this problem a better way?
--
______________________________________________
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr
Powered by Outblaze