Last active

  • Download Gist
1 2 3 4 5 6 7 8
from inspect import getargspec
def filter_dict(d, fltr):
return dict( (x, d[x]) for x in fltr if x in d )
def apply_some(f, *args, **kwargs):
fspec = getargspec(f)
return f(*args, **kwargs) if fspec.keywords else f( *args, **filter_dict(kwargs, fspec.args) )

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.