def gibsSample(pB,pC,pA_B,pD_BC,pE_D,pF_C,label_A,label_B,label_C,label_D,label_E,label_F,T):
#initial state
sample=['A=F','B=n','C=F','D=h','E=F','F=F']
sampleState=[]
for i in range(T):
#draw sample A from p(A | B,C,D,E,F)
sample_A=sampleA(sample,pA_B)
sample[0]=sample_A
#draw sample B from p(B | A,C,D,E,F)
sample_B=sampleB(sample,pB,pA_B,pD_BC)
sample[1]=sample_B
#draw sample C from p(C | A,B,D,E,F)
sample_C=sampleC(sample,pC,pD_BC,pF_C)
sample[2]=sample_C
#draw sample D from p(D | A,B,C,E,F)
sample_D=sampleD(sample,pD_BC,pE_D)
sample[3]=sample_D
#draw sample E from p(E | A,B,C,D,F)
sample_E=sampleE(sample,pE_D)
sample[4]=sample_E
#draw sample F from p(F | A,B,C,D,E)
sample_F=sampleF(sample,pF_C)
sample[5]=sample_F
sampleState.append(sample)
return sampleState
I wrote a sample algorithm. Every time after I sampled from one distribution, the element in variable 'sample' will be modified and after a circle, I want to append it in the list 'sampleState'. But why it seems the 'sampleState' only appended the initial 'sample' but not the sample I modified? I iterated the loop for 2000 times and all the elements in 'sampleState' are just the same with the initial state, but I checked the 'sample' in every iteration there was no problem.