On Sat, Oct 13, 2012 at 10:18 AM, Steven D'Aprano
[..] but I think that puts the emphasis on the wrong thing. If (and that's a big if) we did something like this, it should be a pair of methods __op__ and the right-hand version __rop__ which get called on the *operands*, not the operator/function object:
def __op__(self, other, symbol)
I thought the operator should have a say in how it operates, e.g. the operater `dot` could call __dot__ in its operands. class Vector: def _dot(self, other): return sum([i * j for i, j in zip(self, other)]) class dot(operator): def __infix__(self, left, right): return left._dot(left, right)
Vector([1,2,3]) dot Vector([3,4,5]) 26
Making the declaration and import of operators more explicit than the `def __op__(self, other, symbol)` version. We could put [/, *, ., //, etc...] in __builtins__ Yuval