Python Issue #26654: Inspect keyword arguments of functools.partial. by iceboy233 · Pull Request #328 · python/asyncio (original) (raw)
@1st1 This is just a quick fix for the issue that the error message includes positional arguments but it does not include keyword arguments which may be misleading. I agree that the original code looks ugly, but let's leave it as is as it does not cause any problem.
btw There are two problems using inspect.signature
. Firstly, it does not work on builtin functions such as print
, len
, repr
. It also does not work on any composition that includes these "non-workable functions" by functools.partial
.
inspect.signature(print) ValueError: no signature found for builtin inspect.signature(functools.partial(print, 0)) ValueError: no signature found for builtin
Secondly, it does not recognize functools.partial.
str(inspect.signature(functools.partial(lambda x: x, 0))) '()'