I canβt imagine which of the reasons for such code.
Perhaps there was a reason for the internal function in older versions, like other Ops.
For example, this has a slightly larger meaning:
class some_class(parent_class): def doOp(self, op, x, y): def add(x, y): return x + y def sub(x,y): return x - y return locals()[op](x,y) some_class().doOp('add', 1,2)
but instead, the inner function should be ("private")):
class some_class(object): def _add(self, x, y): return x + y def doOp(self, x, y): return self._add(x,y)
Jochen Ritzel Oct 19 '09 at 2:55 a.m. 2009-10-19 14:55
source share