diff options
author | cookedm <cookedm@localhost> | 2006-06-15 17:46:48 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2006-06-15 17:46:48 +0000 |
commit | 1174b739acf3637626ef216f970bee84e545fe99 (patch) | |
tree | 863647873b6a550c4a4381dc6c31c66f35b7a907 /numpy/lib/utils.py | |
parent | bd83339b9e42ddf3d92339b41e6a6bb93ce68051 (diff) | |
download | numpy-1174b739acf3637626ef216f970bee84e545fe99.tar.gz |
For `deprecated`, include a note about the function being deprecated in its docstring.
Also set the __name__ attribute and copy over function attributes.
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 92efe06d7..1304adb42 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -33,4 +33,13 @@ def deprecate(func, oldname, newname): warnings.warn("%s is deprecated, use %s" % (oldname, newname), DeprecationWarning) return func(*args, **kwds) + newfunc.__name__ = oldname + doc = func.__doc__ + depdoc = '%s is DEPRECATED in numpy: use %s instead' % (oldname, newname,) + if doc is None: + doc = depdoc + else: + doc = '\n'.join([depdoc, doc]) + newfunc.__doc__ = doc + newfunc.__dict__.update(func.__dict__) return newfunc |