引用列表

class test:
    def contr1(self):
        #val = struct()
        #print 'contr1, before, val1',val.val1
        #print 'contr1, before, val2',val.val2
        #self.follower(val)
        #print 'contr1, after, val1',val.val1
        #print 'contr1, after, val2',val.val2


        self.a = ['1', '2']
        print '1',self.a
        self.changer(self.a)
        print '2',self.a


    def follower(self, val):
        print 'follower, origin, val1',val.val1
        print 'follower, origin, val2',val.val2
        val.val1 = 2
        val.val2 = 'zhang'
        print 'follower, changed, val1',val.val1
        print 'follower, changed, val2',val.val2


    def changer(self, val):
        print '3',val
        val.pop()
        print '4',val


class struct:
    val1 = 1
    val2 = 'song'


test = test()
test.contr1()
        
        


你可能感兴趣的:(struct,Class)