def _abstract_binop(opname): oper = BINARY_OPS.get(opname) if oper == '%': oper = '%%' oper = '%s(%%s, %%s)' % opname if not oper else '%%s%s%%s' % oper @func_renamer('descr_' + opname) def descr_binop(self, space, w_other): raise NotImplementedError descr_binop.__doc__ = "x.__%s__(y) <==> %s" % (opname, oper % ('x', 'y')) descr_rbinop = func_with_new_name(descr_binop, 'descr_r' + opname) descr_rbinop.__doc__ = "x.__r%s__(y) <==> %s" % (opname, oper % ('y', 'x')) return descr_binop, descr_rbinop
def _abstract_binop(opname): oper = BINARY_OPS.get(opname) if oper == '%': oper = '%%' oper = '%s(%%s, %%s)' % opname if not oper else '%%s%s%%s' % oper @func_renamer('descr_' + opname) def descr_binop(self, space, w_other): raise NotImplementedError descr_binop.__doc__ = "x.__%s__(y) <==> %s" % (opname, oper % ('x', 'y')) descr_rbinop = func_with_new_name(descr_binop, 'descr_r' + opname) descr_rbinop.__doc__ = "x.__r%s__(y) <==> %s" % (opname, oper % ('y', 'x')) return descr_binop, descr_rbinop
def _abstract_binop(opname): oper = BINARY_OPS.get(opname) if oper == "%": oper = "%%" oper = "%s(%%s, %%s)" % opname if not oper else "%%s%s%%s" % oper @func_renamer("descr_" + opname) def descr_binop(self, space, w_other): raise NotImplementedError descr_binop.__doc__ = "x.__%s__(y) <==> %s" % (opname, oper % ("x", "y")) descr_rbinop = func_with_new_name(descr_binop, "descr_r" + opname) descr_rbinop.__doc__ = "x.__r%s__(y) <==> %s" % (opname, oper % ("y", "x")) return descr_binop, descr_rbinop