I'm using getattr to call different functions depending on a variable.
Im doing something like that:
getattr(foo, bar) ()
That works, calling functions like foo.bar()
My problem is that I have 'bar' functions and I want to call it with different parameters. For example:
def f1() :
pass
def f2(param1) :
pass
def f3(param1,param2) :
pass
so 'bar' could be f1, f2, or f3
I tried this: assumming that params is a list which contains all parameters needed for the 'bar' function
getattr(foo, bar) (for p in params :)
I watching for a "clean" solution, with no needed to watch the length on the params variable
**kwargs
too, just so he doesn't end up with hard to track down bugs later on should he attempt to use keyword arguments. – Jene