summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-06-02 17:31:54 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-06-02 17:31:54 +0000
commitce9414d3007101af1c18d674bd162cdef48c564d (patch)
treea2234fcbf7c2582b35cbb4768f56d955e9638e55
parent4327faedf775668e4d2178f0ddd27ced9a082a7c (diff)
downloadnumpy-ce9414d3007101af1c18d674bd162cdef48c564d.tar.gz
Use convertcode to replace matrixmultiply with dot. Add DeprecationWarning to several old Numeric calls.
-rw-r--r--numpy/core/oldnumeric.py18
-rw-r--r--numpy/lib/convertcode.py2
2 files changed, 15 insertions, 5 deletions
diff --git a/numpy/core/oldnumeric.py b/numpy/core/oldnumeric.py
index 4674cfdd9..ddec9439d 100644
--- a/numpy/core/oldnumeric.py
+++ b/numpy/core/oldnumeric.py
@@ -147,14 +147,22 @@ typecodes = {'Character':'S1',
def sarray(a, dtype=None, copy=False):
return array(a, dtype, copy)
+def _deprecate(func, oldname, newname):
+ import warnings
+ def newfunc(*args,**kwds):
+ warnings.warn("%s is deprecated, use %s" % (oldname, newname),
+ DeprecationWarning)
+ return func(*args, **kwds)
+ return newfunc
+
# backward compatibility
-arrayrange = mu.arange
-cross_correlate = correlate
+arrayrange = _deprecate(mu.arange, 'arrayrange', 'arange')
+cross_correlate = _deprecate(correlate, 'cross_correlate', 'correlate')
# deprecated names
-matrixmultiply = mu.dot
-outerproduct = outer
-innerproduct = mu.inner
+matrixmultiply = _deprecate(mu.dot, 'matrixmultiply', 'dot')
+outerproduct = _deprecate(outer, 'outerproduct', 'outer')
+innerproduct = _deprecate(mu.inner, 'innerproduct', 'inner')
from cPickle import dump, dumps
diff --git a/numpy/lib/convertcode.py b/numpy/lib/convertcode.py
index 1db3ecc85..67a98cb1d 100644
--- a/numpy/lib/convertcode.py
+++ b/numpy/lib/convertcode.py
@@ -17,6 +17,7 @@ Makes the following changes:
* Convert xx.savespace(?) to pass + ## xx.savespace(?)
#### -- not * Convert a.shape = ? to a.reshape(?)
* Prints warning for use of bool, int, float, copmlex, object, and unicode
+ * replaces matrixmultiply with dot
"""
__all__ = ['fromfile', 'fromstr']
@@ -65,6 +66,7 @@ def replaceattr(astr):
astr = astr.replace(".byteswapped()",".byteswap()")
astr = astr.replace(".toscalar()", ".item()")
astr = astr.replace(".itemsize()",".itemsize")
+ astr = astr.replace("matrixmultiply","dot")
# preserve uses of flat that should be o.k.
tmpstr = flatindex_re.sub("@@@@\\2",astr)
# replace other uses of flat