Created
December 16, 2009 02:11
-
-
Save daeken/257524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sanitizeArgs(func): | |
if func.func_code.co_flags & 8: # Has **var | |
return func # Can't know what arguments it takes | |
accepts = func.func_code.co_varnames[:func.func_code.co_argcount] | |
def sub(*args, **kwargs): | |
return func(*args, **dict((key, val) for key, val in kwargs.items() if key in accepts)) | |
return sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment