bundles / numpy 2.4.4 / numpy / lib / _utils_impl / deprecate
function
numpy.lib._utils_impl:deprecate
source: /numpy/lib/_utils_impl.py:207
Signature
def deprecate(*args, **kwargs)Summary
Issues a DeprecationWarning, adds warning to old_name's docstring, rebinds old_name.__name__ and returns the new function object.
Extended Summary
This function may also be used as a decorator.
Parameters
func: functionThe function to be deprecated.
old_name: str, optionalThe name of the function to be deprecated. Default is None, in which case the name of func is used.
new_name: str, optionalThe new name for the function. Default is None, in which case the deprecation message is that old_name is deprecated. If given, the deprecation message is that old_name is deprecated and new_name should be used instead.
message: str, optionalAdditional explanation of the deprecation. Displayed in the docstring after the warning.
Returns
old_func: functionThe deprecated function.
Examples
Note that ``olduint`` returns a value after printing Deprecation Warning:olduint = np.lib.utils.deprecate(np.uint) olduint(6)⚠
Traceback (most recent call last):
File "<doctest numpy.lib._utils_impl:deprecate[0]>", line 1, in <module>
olduint(6)
^^^^^^^
NameError: name 'olduint' is not defined
Aliases
numpy.lib._utils_impl.deprecate