summaryrefslogtreecommitdiff
path: root/numpy/lib/twodim_base.py
diff options
context:
space:
mode:
authorjaimefrio <jaime.frio@gmail.com>2014-05-27 10:42:19 -0700
committerjaimefrio <jaime.frio@gmail.com>2014-05-27 10:44:19 -0700
commit2f7cb25c7ac9691695ba7d8bf085e7c5c8e201de (patch)
treea222d735ac36921a54ba662e1497bf4b101b2fd4 /numpy/lib/twodim_base.py
parente4dc0c9c0a094844e2db60685a59eebe9b6a2bbb (diff)
downloadnumpy-2f7cb25c7ac9691695ba7d8bf085e7c5c8e201de.tar.gz
STY: Use `.astype`'s `copy` kwarg in `np.tri`
Replace an explicit type check with setting `copy=False` in call to `astype`.
Diffstat (limited to 'numpy/lib/twodim_base.py')
-rw-r--r--numpy/lib/twodim_base.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py
index 4c634921d..a8925592a 100644
--- a/numpy/lib/twodim_base.py
+++ b/numpy/lib/twodim_base.py
@@ -11,8 +11,7 @@ __all__ = ['diag', 'diagflat', 'eye', 'fliplr', 'flipud', 'rot90', 'tri',
from numpy.core.numeric import (
asanyarray, subtract, arange, zeros, greater_equal, multiply, ones,
- asarray, where, dtype as np_dtype, less, int8, int16, int32, int64,
- empty, promote_types
+ asarray, where, less, int8, int16, int32, int64, empty, promote_types
)
from numpy.core import iinfo
@@ -415,8 +414,7 @@ def tri(N, M=None, k=0, dtype=float):
arange(-k, M-k, dtype=_min_int(-k, M - k)))
# Avoid making a copy if the requested type is already bool
- if np_dtype(dtype) != np_dtype(bool):
- m = m.astype(dtype)
+ m = m.astype(dtype, copy=False)
return m