Lichen

tests/lambda.py

1031:aa1826243f0c
5 months ago Paul Boddie Avoid creating zero-length temporary arrays.
     1 f = lambda x: (x, 1)     2      3 class C:     4     f = lambda x: (x, 2)     5      6 print f(123)            # (123, 1)     7      8 c = C()     9 print c.f               # __main__.C.$l0    10 print c.f(123)          # (123, 2)    11     12 c.f = f    13 print c.f(123)          # (123, 1)    14     15 C.f = f    16 c2 = C()    17 print c2.f(123)         # (123, 1)