2011-05-23 53 views

回答

4

.args包含传递给部分函数的参数。如果您想获得原始函数期望的参数,请使用.func属性上链接的inspect解决方案。

您可以通过一个functools.partial对象上调用dir发现了这一点:

>>> dir(x) 
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'args', 'func', 'keywords'] 
+0

感谢,要求检查的my_partial_function.func工作 – 2011-05-23 14:12:54