From: Finn B. <bc...@us...> - 2002-01-13 18:34:48
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv22193 Modified Files: PythonVisitor.py Log Message: Support truediv and floordiv (pep-238). Index: PythonVisitor.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonVisitor.py,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** PythonVisitor.py 2001/12/07 13:01:24 2.10 --- PythonVisitor.py 2002/01/13 18:34:46 2.11 *************** *** 391,395 **** def sub_2op(self, node): return self.binop(node, 'sub') def mul_2op(self, node): return self.binop(node, 'mul') ! def div_2op(self, node): return self.binop(node, 'div') def mod_2op(self, node): return self.binop(node, 'mod') def and_2op(self, node): return self.binop(node, 'and') --- 391,400 ---- def sub_2op(self, node): return self.binop(node, 'sub') def mul_2op(self, node): return self.binop(node, 'mul') ! def div_2op(self, node): ! if self.walker.getFutures().areDivisionOn(): ! return self.binop(node, 'truediv') ! else: ! return self.binop(node, 'div') ! def floordiv_2op(self, node): return self.binop(node, 'floordiv') def mod_2op(self, node): return self.binop(node, 'mod') def and_2op(self, node): return self.binop(node, 'and') *************** *** 420,424 **** def aug_minus(self, node): return self.aug_binaryop(node, "__isub__") def aug_multiply(self, node): return self.aug_binaryop(node, "__imul__") ! def aug_divide(self, node): return self.aug_binaryop(node, "__idiv__") def aug_modulo(self, node): return self.aug_binaryop(node, "__imod__") def aug_and(self, node): return self.aug_binaryop(node, "__iand__") --- 425,435 ---- def aug_minus(self, node): return self.aug_binaryop(node, "__isub__") def aug_multiply(self, node): return self.aug_binaryop(node, "__imul__") ! def aug_divide(self, node): ! if self.walker.getFutures().areDivisionOn(): ! return self.aug_binaryop(node, "__itruediv__") ! else: ! return self.aug_binaryop(node, "__idiv__") ! def aug_floordivide(self, node): ! return self.aug_binaryop(node, "__ifloordiv__") def aug_modulo(self, node): return self.aug_binaryop(node, "__imod__") def aug_and(self, node): return self.aug_binaryop(node, "__iand__") |