python - unittest testcase setup new object -
i'm using pydev in classic eclipse 4.2.2 python2.7. please consider code , result below read. suppose create object variable of predefined value. now, suppose change value , create new object of same name (i.e., old name points new object). expect old name point new object value not differ predefined value given in class definition. not case. suggestions why? code: class example(object): veryimportantdict = {'a': 0} def __init__(self): pass def set_veryimportantnumber(self,key,val): self.veryimportantdict[key] = val if __name__ == '__main__': test = example() print "new object: ", test print "new object's dict: ",test.veryimportantdict test.set_veryimportantnumber('a',5) print "old object's dict: ",test.veryimportantdict test = example() print "new object: ", test print "new object's dict: ",test.veryimportantdict which ...