diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-12-30 11:10:41 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-12-30 11:10:41 +0000 |
commit | 79d187afc7b9085993f016bf35fc296f447b9660 (patch) | |
tree | 6f94fc0721b8eb5e9032b45d1229a3692fc08206 /numpy/lib/utils.py | |
parent | 5896cb8c7aba4477bd9d09fb94a129ee2e8ad11a (diff) | |
download | numpy-79d187afc7b9085993f016bf35fc296f447b9660.tar.gz |
Fix deprecate_with_doc and deprecate for builtin functions.
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 048ffafc0..a3bdc743b 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -96,13 +96,16 @@ def deprecate(func, oldname=None, newname=None): import warnings if oldname is None: - oldname = func.func_name + try: + oldname = func.func_name + except AttributeError: + oldname = func.__name__ if newname is None: str1 = "%s is deprecated" % (oldname,) - depdoc = "%s is DEPRECATED!" % (oldname,) + depdoc = "%s is DEPRECATED!!" % (oldname,) else: str1 = "%s is deprecated, use %s" % (oldname, newname), - depdoc = '%s is DEPRECATED! -- use %s instead' % (oldname, newname,) + depdoc = '%s is DEPRECATED!! -- use %s instead' % (oldname, newname,) def newfunc(*args,**kwds): warnings.warn(str1, DeprecationWarning) @@ -113,7 +116,7 @@ def deprecate(func, oldname=None, newname=None): if doc is None: doc = depdoc else: - doc = '\n'.join([depdoc, doc]) + doc = '\n\n'.join([depdoc, doc]) newfunc.__doc__ = doc try: d = func.__dict__ @@ -128,7 +131,7 @@ def deprecate_with_doc(somestr): with 'somestr' that is added to the functions docstring. Example: - depmsg = 'function numpy.lib.foo has been merged into numpy.lib.io.foobar' + depmsg = 'function scipy.foo has been merged into numpy.foobar' @deprecate_with_doc(depmsg) def foo(): pass |