I’m making a program in which I use 6 global sets. Inside of various functions that are called I make temporary backup of those sets by doing something like temp_set = set. When I do this, the temporary set is somehow modified when I changed the original set. I assume that Python is setting temp_set to a pointer to the original set here. How can I prevent it from doing this. Rapid response would be immensely appreciated.
I’m making a program in which I use 6 global sets. Inside of various
Share
Use to the
copymodule to create shallow/deep copies.Even better, use
set.copy()