inspect.getfullargspec(ec2.create_instance)
should normally give you everything you need. Align args
and defaults
on the right side. For example:
def foo(a, b=3, *c, d=5):
m = a + b
return m
argspec = inspect.getfullargspec(ec2.create_instance)
{**dict(zip(argspec.args[-len(argspec.defaults):], argspec.defaults)),
**argspec.kwonlydefaults}
# => {'b': 3, 'd': 5}
As @9769953 says, if a parameter is bundled in **kwargs
, it is processed by the function's code, and is thus not found in the function signature.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…