list of polynomial functions

Josiah Manson slomojo83 at gmail.com
Thu Jun 15 17:26:26 EDT 2006


> The `i` is the problem.  It's not evaluated when the lambda *definition*
> is executed but when the lambda function is called.  And then `i` is
> always == `n`.  You have to explicitly bind it as default value in the
> lambda definition:
>
>  		polys.append(lambda x, i=i: polys[i](x)*x)

Thank you for your help.




More information about the Python-list mailing list