]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
CCAR: ajout __floordiv__ pour division entiere
authorChristian Caremoli <>
Thu, 15 Nov 2007 17:12:56 +0000 (17:12 +0000)
committerChristian Caremoli <>
Thu, 15 Nov 2007 17:12:56 +0000 (17:12 +0000)
Extensions/param2.py

index 89f6464bccf0c3358ca1fca1c1f6ad497fb3df95..2546bc22817830f3497c5e80f950feb109fdb089 100644 (file)
@@ -38,8 +38,11 @@ class Formula:
     def __mul__(self, other): return Binop('*', self, other)
     def __rmul__(self, other): return Binop('*', other, self)
     def __div__(self, other): return Binop('/', self, other)
-    def __truediv__(self, other): return Binop('/', self, other)
     def __rdiv__(self, other): return Binop('/', other, self)
+    def __truediv__(self, other): return Binop('/', self, other)
+    def __rtruediv__(self, other): return Binop('/', other, self)
+    def __floordiv__(self, other): return Binop('//', self, other)
+    def __rfloordiv__(self, other): return Binop('//', other, self)
     def __pow__(self, other): return Binop('**', self, other)
     def __rpow__(self, other): return Binop('**', other, self)
     def __getitem__(self,i):return Binop('[]',self,i)
@@ -49,6 +52,7 @@ class Binop(Formula):
               '*': lambda a, b: a * b,
               '-': lambda a, b: a - b,
               '/': lambda a, b: a / b,
+              '//': lambda a, b: a // b,
               '**': lambda a, b: a ** b,
               '[]': lambda a, b: a[b] ,
             }