argument "ddefaulted argument "cdefaulted argument "bdefaulted argument "cdefaulted argument "bdefaulted argument "cdefaulted argument "bdefaulted on validation errorswe get an exception as before when one of the method test lines is uncommentedunless the - command-line argument is passed to python to disable the decorator' logictypeerrorgiveraise argument "percentnot in implementation details this decorator' code relies on both introspection apis and subtle constraints of argument passing to be fully general we could in principle try to mimic python' argument matching logic in its entirety to see which names have been passed in which modesbut that' far too much complexity for our tool it would be better if we could somehow match arguments passed by name against the set of all expected argumentsnamesin order to determine which position arguments actually appear in during given call function introspection it turns out that the introspection api available on function objects and their associated code objects has exactly the tool we need this api was briefly introduced in but we'll actually put it to use here the set of expected argument names is simply the first variable names attached to function' code objectin python (and for compatibilitydef func(abce=truef=none) code func __code__ code co_nlocals code co_varnames (' '' '' '' '' '' '' 'code co_varnames[:code co_argcount(' '' '' '' '' ' decorators argsthree requiredtwo defaults plus two more local variables code object of function object all local variable names <=first locals are expected args