Hi all,<br><br>I've written  a function [1] 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 accepts.<br>


<br>For example:<br><br style="font-family: courier new,monospace;"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">def foo(x=1, y=2):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    return (x,y)</span><br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">apply_some(foo, y=0, z="hi") // calls foo(y=0)</span><br>




<span style="font-family: courier new,monospace;">-> (1,0)<br></span></div><br>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?<br>


<br>Cheers,<br>Andrey<br><br>1. <a href="http://gist.github.com/183375" target="_blank">http://gist.github.com/183375</a><br><br>