5 months ago | Paul Boddie | raw annotate files changeset graph | Avoid creating zero-length temporary arrays. | value-replacement |
1 f = lambda x: (x, 1) 2 3 g = lambda x: x.f 4 5 h = lambda x: x(234) 6 7 class C: 8 f = lambda x: (x, 2) 9 10 print f(123) # (123, 1) 11 12 c = C() 13 print c.f # __main__.C.$l0 14 print c.f(123) # (123, 2) 15 16 c.f = f 17 print c.f(123) # (123, 1) 18 19 C.f = f 20 c2 = C() 21 print c2.f(123) # (123, 1) 22 23 print g # __main__.C.$l1 24 print g(c) # __main__.C.$l0 25 26 a = g(c) 27 print a(123) # (123, 1) 28 29 print h(a) # (234, 1)