[Python-ideas] Function to apply superset of arguments to a function
anfedorov at gmail.com
Wed Sep 9 03:07:53 CEST 2009
I've written a function  called apply_some which takes a set of keywords
arguments, filters only those a function is expecting, and calls the
function with only those arguments. This is meant to suppress TypeErrors - a
way to abstract the logic which checks what arguments a passed-in function
def foo(x=1, y=2):
apply_some(foo, y=0, z="hi") // calls foo(y=0)
I'd like to expand this to fill undefined arguments with None, but before I
do, does anyone know of any packages/libraries which either do something
similar or would make this code cleaner?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas