summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2013-04-13 09:41:22 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2013-05-31 19:16:02 +0200
commit5c8d5c263b93700ae92aff38bb9a8d05c0a185e6 (patch)
tree0f2aec8e1516213f81378d253b465d8aa6f1c04d
parent44a796154a4d349768c6e2244b39e8a69d2d1680 (diff)
downloadnumpy-5c8d5c263b93700ae92aff38bb9a8d05c0a185e6.tar.gz
MAINT: adept divisions for truedivide
Following deprecations would cause problems otherwise.
-rw-r--r--numpy/core/defchararray.py4
-rw-r--r--numpy/lib/index_tricks.py2
-rw-r--r--numpy/lib/shape_base.py2
-rw-r--r--numpy/random/tests/test_regression.py2
4 files changed, 5 insertions, 5 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 2a8b31616..92995baa1 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -90,7 +90,7 @@ def _get_num_chars(a):
for a unicode array this is itemsize / 4.
"""
if issubclass(a.dtype.type, unicode_):
- return a.itemsize / 4
+ return a.itemsize // 4
return a.itemsize
@@ -2593,7 +2593,7 @@ def array(obj, itemsize=None, copy=True, unicode=None, order=None):
# to divide by the size of a single Unicode character,
# which for Numpy is always 4
if issubclass(obj.dtype.type, unicode_):
- itemsize /= 4
+ itemsize //= 4
if unicode is None:
if issubclass(obj.dtype.type, unicode_):
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index b3c9b72bc..ca3d60869 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -157,7 +157,7 @@ class nd_grid(object):
size.append(int(abs(step)))
typ = float
else:
- size.append(math.ceil((key[k].stop - start)/(step*1.0)))
+ size.append(int(math.ceil((key[k].stop - start)/(step*1.0))))
if isinstance(step, float) or \
isinstance(start, float) or \
isinstance(key[k].stop, float):
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index e81bae5fc..f8734ea5e 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -830,5 +830,5 @@ def tile(A, reps):
dim_in = shape[i]
dim_out = dim_in*nrep
shape[i] = dim_out
- n /= max(dim_in,1)
+ n //= max(dim_in,1)
return c.reshape(shape)
diff --git a/numpy/random/tests/test_regression.py b/numpy/random/tests/test_regression.py
index d2bbdbfb7..891345b6a 100644
--- a/numpy/random/tests/test_regression.py
+++ b/numpy/random/tests/test_regression.py
@@ -74,7 +74,7 @@ class TestRegression(TestCase):
np.random.seed(i)
m.seed(4321)
# If m.state is not honored, the result will change
- assert_array_equal(m.choice(10, size=10, p=np.ones(10.)/10), res)
+ assert_array_equal(m.choice(10, size=10, p=np.ones(10)/10), res)
if __name__ == "__main__":
run_module_suite()