summaryrefslogtreecommitdiff
path: root/scipy/base/numeric.py
diff options
context:
space:
mode:
authoredschofield <edschofield@localhost>2005-10-22 11:21:21 +0000
committeredschofield <edschofield@localhost>2005-10-22 11:21:21 +0000
commit14bdbe98ab230e8252333a185aebc27b3024810d (patch)
tree32b3a65e6d21b9aa19ce6808e885873f2b772129 /scipy/base/numeric.py
parent584a026383ebc2422e787de8bd97d223b4d341bd (diff)
downloadnumpy-14bdbe98ab230e8252333a185aebc27b3024810d.tar.gz
EJS: Patch to use proper True and False values rather than 1 and 0. This allows stricter
type checking when we expect a boolean value to prevent the user shooting himself in the foot. Example: >>> a = zeros(1,2,3) used to succeed, creating an array of shape (1,), dtype 2, and fortran=True, which was probably not intended. It now raises a TypeError. [The user probably wants something else, like zeros((1,2,3)).]
Diffstat (limited to 'scipy/base/numeric.py')
-rw-r--r--scipy/base/numeric.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scipy/base/numeric.py b/scipy/base/numeric.py
index ce631e016..92b19e02d 100644
--- a/scipy/base/numeric.py
+++ b/scipy/base/numeric.py
@@ -33,12 +33,12 @@ def asarray(a, dtype=None, fortran=False):
no copy is performed if a is already an array. Subclasses are converted
to base class ndarray.
"""
- return array(a, dtype, copy=0, fortran=fortran)
+ return array(a, dtype, copy=False, fortran=fortran)
-def asanyarray(a, dtype=None,copy=0,fortran=False):
+def asanyarray(a, dtype=None,copy=False,fortran=False):
"""will pass subclasses through...
"""
- return array(a, dtype, copy=0, fortran=fortran, subok=1)
+ return array(a, dtype, copy=False, fortran=fortran, subok=1)
def isfortran(a):
return a.flags['FNC']
@@ -244,7 +244,7 @@ def load(file):
# These are all essentially abbreviations
# These might wind up in a special abbreviations module
-def ones(shape, dtype=int_, fortran=0):
+def ones(shape, dtype=int_, fortran=False):
"""ones(shape, dtype=int_) returns an array of the given
dimensions which is initialized to all ones.
"""
@@ -271,8 +271,8 @@ def allclose (a, b, rtol=1.e-5, atol=1.e-8):
The absolute error atol comes into play for those elements
of y that are very small or zero; it says how small x must be also.
"""
- x = array(a, copy=0)
- y = array(b, copy=0)
+ x = array(a, copy=False)
+ y = array(b, copy=False)
d = less(absolute(x-y), atol + rtol * absolute(y))
return alltrue(ravel(d))