[英]Signature method in Inspect module for python 2
I am trying to run a Python 3 library in Python 2. It uses inspect
module and signature
method which is not implemented in Python 2 version of the module.我正在尝试在 Python 2 中运行 Python 3 库。它使用在模块的 Python 2 版本中未实现的inspect
模块和signature
方法。
signature = inspect.signature(initializer)
There is no implementation in __future__
that can help (at least, I haven't found one). __future__
中没有可以提供帮助的实现(至少,我还没有找到)。
How can I replace this method?我怎样才能替换这个方法?
inspect2
is backport of the entire Python 3.6 inspect
module to Python 2.7. inspect2
是整个 Python 3.6 inspect
模块到 Python 2.7 的inspect2
移植。 Like funcsigs
it is also available from PyPI, and inspect2
is more recently maintained.与funcsigs
一样,它也可以从 PyPI 获得,而inspect2
是最近维护的。 (As I'm writing this, inspect2
was last updated in 2019, while funcsigs
was last updated in 2016.) (在我写这篇文章时, inspect2
上次更新是在 2019 年,而funcsigs
上次更新是在 2016 年。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.