5 months ago | Paul Boddie | raw annotate files changeset graph | Merged changes from the value-replacement branch. | value-replacement-generic |
1 def test(a): 2 a = a - 1.0 3 return a 4 5 def test_assign(l, x): 6 l[0] = x 7 8 def test_augmented(l, x): 9 l[0] += x + l[1] 10 11 x = 2.0 12 print test(x) # 1.0 13 print x # 2.0 14 15 l = [1, 2, 3] 16 test_assign(l, 4) 17 print l # [4, 2, 3] 18 19 l2 = [1, 2, 3] 20 test_augmented(l2, 1) 21 print l2 # [4, 2, 3] 22 23 l3 = [1.0, 2.0, 3.0] 24 test_assign(l3, 4.0) 25 print l3 # [4.0, 2.0, 3.0] 26 27 l4 = [1.0, 2.0, 3.0] 28 test_augmented(l4, 1.0) 29 print l4 # [4.0, 2.0, 3.0]