numpy.deprecate
-
numpy.deprecate(*args, **kwargs)[source] -
Issues a DeprecationWarning, adds warning to
old_name’s docstring, rebindsold_name.__name__and returns the new function object.This function may also be used as a decorator.
- Parameters
-
-
funcfunction -
The function to be deprecated.
-
old_namestr, optional -
The name of the function to be deprecated. Default is None, in which case the name of
funcis used. -
new_namestr, optional -
The new name for the function. Default is None, in which case the deprecation message is that
old_nameis deprecated. If given, the deprecation message is thatold_nameis deprecated andnew_nameshould be used instead. -
messagestr, optional -
Additional explanation of the deprecation. Displayed in the docstring after the warning.
-
- Returns
-
-
old_funcfunction -
The deprecated function.
-
Examples
Note that
olduintreturns a value after printing Deprecation Warning:>>> olduint = np.deprecate(np.uint) DeprecationWarning: `uint64` is deprecated! # may vary >>> olduint(6) 6
© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.20/reference/generated/numpy.deprecate.html