From 1174b739acf3637626ef216f970bee84e545fe99 Mon Sep 17 00:00:00 2001 From: cookedm Date: Thu, 15 Jun 2006 17:46:48 +0000 Subject: For `deprecated`, include a note about the function being deprecated in its docstring. Also set the __name__ attribute and copy over function attributes. --- numpy/lib/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'numpy/lib/utils.py') 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 -- cgit v1.2.1