Skip to content

Commit 6aacf08

Browse files
committed
Adding division support for python2
1 parent 503b49d commit 6aacf08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arrayfire/array.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def __imul__(self, other):
176176
def __rmul__(self, other):
177177
return binary_funcr(other, self, clib.af_mul)
178178

179+
# Necessary for python3
179180
def __truediv__(self, other):
180181
return binary_func(self, other, clib.af_div)
181182

@@ -186,6 +187,17 @@ def __itruediv__(self, other):
186187
def __rtruediv__(self, other):
187188
return binary_funcr(other, self, clib.af_div)
188189

190+
# Necessary for python2
191+
def __div__(self, other):
192+
return binary_func(self, other, clib.af_div)
193+
194+
def __idiv__(self, other):
195+
self = binary_func(self, other, clib.af_div)
196+
return self
197+
198+
def __rdiv__(self, other):
199+
return binary_funcr(other, self, clib.af_div)
200+
189201
def __mod__(self, other):
190202
return binary_func(self, other, clib.af_mod)
191203

0 commit comments

Comments
 (0)