Python and Flaming Thunder

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Wed May 14 17:41:58 EDT 2008


On 13 mai, 18:36, Dave Parker <davepar... at flamingthunder.com> wrote:
(snip)

> Also, in Python how do you assign a symbolic equation to a variable?
> Like this?
>
> QuadraticEquation = a*x^2 + b*x + c = 0

quadratic_equation = lambda x, b, c : a*(x**2) + b*x + c == 0

or if x, b and c are supposed to be captured from the current
namespace:

quadratic_equation = lambda : a*(x**2) + b*x + c == 0

> Set statements avoid the confusion of multiple equal signs when
> manipulating symbolic equations:

using '=' for assignement and '==' for equality test does the same
thing. And it's a very common pattern in programming languages.




More information about the Python-list mailing list