NumPy参考 >例行程序 >Miscellaneous routines > numpy.deprecate
numpy.
deprecate
(* args,** kwargs )[源代码] ¶发出DeprecationWarning,向old_name的文档字符串添加警告,重新绑定old_name.__name__
并返回新的函数对象。
此功能也可以用作装饰器。
不推荐使用的功能。
要弃用的函数的名称。默认值为无,在这种情况下,将使用func的名称。
该函数的新名称。默认值为无,在这种情况下,不赞成使用的消息是不赞成使用old_name。如果给出,则弃用消息是不 建议使用old_name,而应使用new_name。
弃用的其他说明。警告后显示在文档字符串中。
不推荐使用的功能。
例子
请注意,olduint
在打印“弃用警告”后返回一个值:
>>> olduint = np.deprecate(np.uint)
DeprecationWarning: `uint64` is deprecated! # may vary
>>> olduint(6)
6