numpy.
deprecate
发出DeprecationWarning,将警告添加到 old_name 的文档字符串,重新绑定 old_name.__name__ 并返回新的函数对象。
old_name.__name__
此函数也可用作装饰器。
要弃用的函数。
要弃用的函数的名称。默认值为“无”,在这种情况下 func 使用。
函数的新名称。默认值是None,在这种情况下,deprecation消息是 old_name 已弃用。如果给定,则deprecation消息是 old_name 已弃用,并且 new_name 应该改为使用。
反对意见的补充说明。显示在警告后的docstring中。
不推荐使用的函数。
实例
注意 olduint 打印弃用警告后返回一个值:
olduint
>>> olduint = np.deprecate(np.uint) DeprecationWarning: `uint64` is deprecated! # may vary >>> olduint(6) 6