2017-03-07 | Paul Boddie | raw annotate files changeset graph | Switched to using normal, named function parameters instead of arrays. This requires a special function to convert any array-based arguments to the positioned arguments. However, parameters no longer need to be dereferenced when used in functions. Specialised macros are required to invoke functions with different numbers of parameters. Fortunately, the macros required can be deduced from the functions defined in the program. | normal-function-parameters |
1 class C: 2 def __init__(self, x, y, z): 3 self.x = x 4 self.y = y 5 self.z = z 6 7 def c(self): 8 return self.x 9 10 class D(C): 11 def d(self): 12 return self.y 13 14 class E(D): 15 def c(self): 16 return self.z 17 18 c = C(1, 2, 3) 19 d = D(1, 2, 3) 20 e = E(1, 2, 3) 21 22 print c.c() # 1 23 print d.c() # 1 24 print e.c() # 3 25 print d.d() # 2 26 print e.d() # 2