Browse files

proper fix for default argument setting

  • Loading branch information...
1 parent e243c79 commit 7cf8e056377e798e389a3f8a585d1822af29d0fb @koelie koelie committed Mar 13, 2013
Showing with 2 additions and 5 deletions.
  1. +2 −5 tornadorpc/utils.py
View
7 tornadorpc/utils.py
@@ -49,11 +49,8 @@ def getcallargs(func, *positional, **named):
else:
extra_args.append(value)
if defaults:
- reverse_args = args[:]
-# reverse_args.reverse()
- for i in range(len(defaults)):
- arg_key = reverse_args[i]
- final_kwargs.setdefault(arg_key, defaults[i])
+ for kwarg, default in zip(args[-len(defaults):], defaults):
+ final_kwargs.setdefault(kwarg, default)
for arg in args:
if arg not in final_kwargs:
raise TypeError("Not all arguments supplied. (%s)", arg)

0 comments on commit 7cf8e05

Please sign in to comment.