Last active
December 20, 2015 04:59
-
-
Save feifangit/6074803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
a = set([hashabledict({1:11}), hashabledict({2:22})]) | |
b = set([hashabledict({1:11}), hashabledict({3:33})]) | |
for i in range(3): | |
print "set a:", a | |
delta = a-b | |
print "delta", delta | |
for item in copy.deepcopy(delta): | |
print id(item) | |
item[1] = "xx" | |
print "*"*10 | |
#--------------result----------------- | |
#set a: set([{1: 11}, {2: 22}]) | |
#delta set([{2: 22}]) | |
#72099512 | |
#********** | |
#set a: set([{1: 11}, {2: 22}]) | |
#delta set([{2: 22}]) | |
#72098600 | |
#********** | |
#set a: set([{1: 11}, {2: 22}]) | |
#delta set([{2: 22}]) | |
#72099512 | |
#********** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment