2020-07-16 | Paul Boddie | raw annotate files changeset graph | Fixed int limit macros by actually using the size of the int type. For wider types such as long, which may be usable on 64-bit platforms in place of int, 1L would need to be used instead of 1 in the calculation. An abstract native integer type might be introduced here and to the native library to allow wider types if appropriate. |
1 a = 4 2 3 def f(x): 4 5 # Test function initialisation (f.$l0). 6 7 def g(y, x=x): 8 9 # Test function initialisation (f.$l0.$l0). 10 11 def h(a, z, x=x, y=y): 12 return x, y, z, a # parameter a overrides global scope 13 14 return h 15 16 return g 17 18 fn = f(1) 19 print fn # __main__.f.$l0 20 print fn(2) # __main__.f.$l0.$l0 21 print fn(2)(5, 3) # (1, 2, 3, 5) 22 print fn(2)(5, 3, 6) # (6, 2, 3, 5) 23 print fn(2)(5, 3, 6, 7) # (6, 7, 3, 5)