'll leave fleshing out the rest of the annotation-based version as suggested exerciseits code would be identical to that of our complete solution shown earlierbecause range-test information is simply on the function instead of in an enclosing scope reallyall this buys us is different user interface for our tool--it will still need to match argument names against expected argument names to obtain relative positions as before in factusing annotation instead of decorator arguments in this example actually limits its utility for one thingannotation only works under python xso is no longer supportedfunction decorators with argumentson the other handwork in both versions more importantlyby moving the validation specifications into the def headerwe essentially commit the function to single role--since annotation allows us to code only one expression per argumentit can have only one purpose for instancewe cannot use range-test annotations for any other role by contrastbecause decorator arguments are coded outside the function itselfthey are both easier to remove and more general--the code of the function itself does not imply single decoration purpose cruciallyby nesting decorators with argumentswe can apply multiple augmentation steps to the same functionannotation directly supports only one with decorator argumentsthe function itself also retains simplernormal appearance stillif you have single purpose in mindand you can commit to supporting onlythe choice between annotation and decorator arguments is largely stylistic and subjective as is so often true in lifeone person' decoration or annotation may well be another' syntactic clutterother applicationstype testing (if you insist!the coding pattern we've arrived at for processing arguments in decorators could be applied in other contexts checking argument data types at development timefor exampleis straightforward extensiondef typetest(**argchecks)def ondecorator(func)def oncall(*pargs**kargs)positionals list(allargs)[:len(pargs)for (argnametypein argchecks items()if argname in kargsif not isinstance(kargs[argname]type)raise typeerror(errmsgelif argname in positionalsposition positionals index(argname decorators