2021-10-31 | Paul Boddie | file changeset files shortlog | Introduced a dedicated integer type based on ssize_t. This allows integers to be used for sizes and lengths in native and low-level operations whilst also supporting their storage in the same amount of space as a pointer, thus avoiding the inflation of attributes that might occur if a larger type were chosen. |
paul@2 | 1 | a = 4 |
paul@2 | 2 | |
paul@2 | 3 | def f(x): |
paul@43 | 4 | def g(y, x=x): |
paul@43 | 5 | def h(z, x=x, y=y): |
paul@2 | 6 | return x, y, z, a |
paul@2 | 7 | return h |
paul@2 | 8 | return g |
paul@2 | 9 | |
paul@266 | 10 | fn = f(1) |
paul@266 | 11 | print fn # __main__.f.$l0 |
paul@266 | 12 | print fn(2) # __main__.f.$l0.$l0 |
paul@266 | 13 | print fn(2)(3) # (1, 2, 3, 4) |
paul@266 | 14 | print fn(2)(3, 5) # (5, 2, 3, 4) |
paul@266 | 15 | print fn(2)(3, 5, 6) # (5, 6, 3, 4) |