summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2005-09-28 20:26:19 +0000
committerTravis Oliphant <oliphant@enthought.com>2005-09-28 20:26:19 +0000
commitb60f3c5f424f20d6e7506db7a4f26dfc3c08fe2e (patch)
treec850314dbad46571f96635a22923e1d2605c235b
parent07a2484e565aeb05a93b0b716160524b42032ab5 (diff)
downloadpython-numpy-b60f3c5f424f20d6e7506db7a4f26dfc3c08fe2e.tar.gz
python-numpy-b60f3c5f424f20d6e7506db7a4f26dfc3c08fe2e.tar.bz2
python-numpy-b60f3c5f424f20d6e7506db7a4f26dfc3c08fe2e.zip
Don't shadow builtins anymore.
-rw-r--r--THANKS.txt2
-rw-r--r--scipy/base/numeric.py4
-rw-r--r--scipy/base/numerictypes.py46
-rw-r--r--scipy/base/src/multiarraymodule.c6
4 files changed, 38 insertions, 20 deletions
diff --git a/THANKS.txt b/THANKS.txt
index cbcbb052c..b2a68c3ff 100644
--- a/THANKS.txt
+++ b/THANKS.txt
@@ -4,3 +4,5 @@ Pearu Peterson for f2py and distutils
Eric Jones for weave
Robert Kern for mtrand, bug fixes and help with distutils.
Fernando Perez for code snippets and ideas
+John Hunter for code snippets (from matplotlib)
+
diff --git a/scipy/base/numeric.py b/scipy/base/numeric.py
index 9683a4d4c..b095ec800 100644
--- a/scipy/base/numeric.py
+++ b/scipy/base/numeric.py
@@ -179,8 +179,8 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1):
#Use numarray's printing function
from arrayprint import array2string, get_printoptions, set_printoptions
-_typelessdata = [int, float, complex]
-if issubclass(intc, pyint):
+_typelessdata = [aint, afloat, acomplex]
+if issubclass(intc, int):
_typelessdata.append(intc)
def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):
diff --git a/scipy/base/numerictypes.py b/scipy/base/numerictypes.py
index 88e253c1b..2773e1e7a 100644
--- a/scipy/base/numerictypes.py
+++ b/scipy/base/numerictypes.py
@@ -20,33 +20,33 @@ Exported symbols include:
c-based names
- bool
+ abool
- object
+ aobject
- void, string, unicode
+ void, astr, aunicode
byte, ubyte,
short, ushort
intc, uintc,
intp, uintp,
- int, uint,
+ aint, uint,
longlong, ulonglong,
single, csingle,
- float, complex,
+ afloat, acomplex,
longfloat, clongfloat,
As part of the type-hierarchy: xx -- is bit-width
generic
- bool
+ abool
numeric
integer
signedinteger (intxx)
byte
short
- int
+ aint
intp int0
longint
longlong
@@ -59,20 +59,20 @@ Exported symbols include:
ulonglong
floating (floatxx)
single
- float (double)
+ afloat (double)
longfloat
complexfloating (complexxx)
csingle
- complex (cfloat, cdouble)
+ acomplex (cfloat, cdouble)
clongfloat
flexible
character
- string
- unicode
+ astr (string)
+ aunicode
void
- object
+ aobject
$Id: numerictypes.py,v 1.17 2005/09/09 22:20:06 teoliphant Exp $
"""
@@ -176,22 +176,34 @@ for a in _tocheck:
# Rework the Python names (so that float and complex and int are consistent
# with Python usage)
#
-complex = cdouble
+acomplex = cdouble
int0 = intp
uint0 = uintp
single = float
csingle = cfloat
-float = double
+afloat = double
intc = int
uintc = uint
-int = long
+aint = long
uint = ulong
cfloat = cdouble
longfloat = longdouble
clongfloat = clongdouble
+
+abool = bool
+aunicode = unicode
+astr = string
+aobject = object
+
+object = pyobject
+unicode = pyunicode
+int = pyint
long = pylong
+float = pyfloat
+complex = pycomplex
+bool = pybool
-del pylong, ulong
+del ulong, pyobject, pyunicode, pyint, pylong, pyfloat, pycomplex, pybool
del _thisdict, _tocheck, a, name, typeobj
del base, bit, char
@@ -209,7 +221,7 @@ arraytypes = {'int': [],
'uint':[],
'float':[],
'complex':[],
- 'others':[bool,object,string,unicode,void]}
+ 'others':[abool,aobject,string,aunicode,void]}
_ibytes = [1,2,4,8,16,32,64]
_fbytes = [2,4,8,10,12,16,32,64]
diff --git a/scipy/base/src/multiarraymodule.c b/scipy/base/src/multiarraymodule.c
index e2a9dd45c..532f60ba0 100644
--- a/scipy/base/src/multiarraymodule.c
+++ b/scipy/base/src/multiarraymodule.c
@@ -2838,13 +2838,17 @@ PyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)
else if (PyType_Check(obj)) {
check_num = PyArray_OBJECT;
if (obj == (PyObject *)(&PyInt_Type))
- check_num = PyArray_INTP;
+ check_num = PyArray_LONG;
else if (obj == (PyObject *)(&PyBool_Type))
check_num = PyArray_BOOL;
else if (obj == (PyObject *)(&PyFloat_Type))
check_num = PyArray_DOUBLE;
else if (obj == (PyObject *)(&PyComplex_Type))
check_num = PyArray_CDOUBLE;
+ else if (obj == (PyObject *)(&PyString_Type))
+ check_num = PyArray_STRING;
+ else if (obj == (PyObject *)(&PyUnicode_Type))
+ check_num = PyArray_UNICODE;
}
else { /* Default -- try integer conversion */
check_num = PyInt_AsLong(obj);