[python-arrayfire] 14/250: Adding division support for python2
    Ghislain Vaillant 
    ghisvail-guest at moszumanska.debian.org
       
    Mon Mar 28 22:59:25 UTC 2016
    
    
  
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.
commit 6aacf08a10b1017e87b0ba91d3d14af609da244e
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Jun 19 18:30:09 2015 -0400
    Adding division support for python2
---
 arrayfire/array.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/arrayfire/array.py b/arrayfire/array.py
index f3d68f4..9f1e156 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -176,6 +176,7 @@ class array(object):
     def __rmul__(self, other):
         return binary_funcr(other, self, clib.af_mul)
 
+    # Necessary for python3
     def __truediv__(self, other):
         return binary_func(self, other, clib.af_div)
 
@@ -186,6 +187,17 @@ class array(object):
     def __rtruediv__(self, other):
         return binary_funcr(other, self, clib.af_div)
 
+    # Necessary for python2
+    def __div__(self, other):
+        return binary_func(self, other, clib.af_div)
+
+    def __idiv__(self, other):
+        self =  binary_func(self, other, clib.af_div)
+        return self
+
+    def __rdiv__(self, other):
+        return binary_funcr(other, self, clib.af_div)
+
     def __mod__(self, other):
         return binary_func(self, other, clib.af_mod)
 
-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git
    
    
More information about the debian-science-commits
mailing list