Function to apply superset of arguments to a function
steven at REMOVE.THIS.cybersource.com.au
Thu Sep 10 05:14:51 CEST 2009
On Wed, 09 Sep 2009 14:58:22 -0700, Carl Banks wrote:
> Use case seems perfectly obvious to me. You have a set of functions
> that use different strategies to accomplish a task, and there is a lot
> of overlap in the arguments used but no consistency. You want to be
> able to swap in different functions so as to try different strategies
> (either while editing, or programmatically). Instead of dealing with
> arguments that change everytime you want to swap in a different
> function, you can use this filter and work with a single argument set.
> The example that pops to my mind is numerical optimization. Many
> numerical optimizers have similar overall strategies but differ in
> underlying details, so they will tend to take different options. An
> argument filter like the OP wrote would be quite handy here.
Even more handy would be an abstraction layer that gives you a consistent
API to work with, instead of the fragile and brittle anti-pattern of
"suppress errors from passing invalid arguments".
More information about the Python-list