[Tutor] constructing semi-arbitrary functions
"André Walker-Loud <walksloud@gmail.com>"
walksloud at gmail.com
Mon Feb 17 23:15:09 CET 2014
> This particular case is easily solved:
>
> def f_lambda(x,pars):
> return lambda x: poly(x,*pars)
>
> You let the closure take care of pars and return a function that takes
> exactly one argument x.
Hi Oscar,
This is the opposite of what I am trying to do. In the example, x represents the data and pars represent the parameters I want to determine, so it is the pars which I need passed into the “func_code.co_varnames” part of f.
Maybe your suggestion gets me in that direction, but I don’t see how.
Thanks,
Andre
More information about the Tutor
mailing list