2021-11-07 | Paul Boddie | file changeset files shortlog | Introduced a value stack, currently unused, referenced by a function parameter alongside the ubiquitous context parameter. | tagged-address-values |
paul@815 | 1 | f = lambda x: (x, 1) |
paul@815 | 2 | |
paul@815 | 3 | class C: |
paul@815 | 4 | f = lambda x: (x, 2) |
paul@815 | 5 | |
paul@815 | 6 | print f(123) # (123, 1) |
paul@815 | 7 | |
paul@815 | 8 | c = C() |
paul@815 | 9 | print c.f # __main__.C.$l0 |
paul@815 | 10 | print c.f(123) # (123, 2) |
paul@815 | 11 | |
paul@815 | 12 | c.f = f |
paul@815 | 13 | print c.f(123) # (123, 1) |
paul@815 | 14 | |
paul@815 | 15 | C.f = f |
paul@815 | 16 | c2 = C() |
paul@815 | 17 | print c2.f(123) # (123, 1) |