[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Sticky Variables



I've run into that "sticky variables" problem again:

>>> code = {".":[],"c":["crate"]}
>>> a = code["."]
>>> b = code["."]
>>> a ==b
True
>>> a is b
True

One solution is:
>>> import copy
>>> a = copy.copy(code["."])
>>> b = copy.copy(code["."])
>>> a == b
True
>>> a is b
False

But is there a better way to make it clear I want the value, not an actual reference?