kislyuk/ensure — pull request #6 by harrisonmetz (2014-06-27 21:50:07+00:00)
Title: Only look at variables that are arguments in the function

f.__code__.co_varnames are ALL the variables in a function (not just the ones which are arguments). Those are the first ones in up to co_argcount so stop loping after it. (Of course, it won't be in the __annotations__, but if there is a long function it's a waste of time to check these variables as the decorator is being applied).