ENH Makes _deprecate_positional_args slightly faster
@@ -56,8 +56,10 @@ def _deprecate_positional_args(f):
@wraps(f)
def inner_f(*args, **kwargs):
extra_args = len(args) - len(all_args)
- if extra_args > 0:
- # ignore first 'self' argument for instance methods
+ if extra_args <= 0:
+ return f(*args, **kwargs)
+
+ # extra_args > 0
args_msg = ['{}={}'.format(name, arg)
for name, arg in zip(kwonly_args[:extra_args],
args[-extra_args:])]
