newbie: generate a function based on an expression

Jacob Rael jacob.rael at
Tue Dec 13 15:44:34 CET 2005

Overall I am trying to learn OOP by porting
CppSim ( to Python.

In CppSim, classes are defined that allow various functions to be
defined, like amplifiers. In some cases they are linear:

y = A*x

some have offsets:

y = A*x + off

some are non-linear

y = A*x - C*x**3

The coefficients and the function will remain constant once the
function is defined.

I read about the security concerns involved in using eval(). I don't
expect this project to grow to the point where I require a web
interface. However, since I am learning, I might as well learn the
right way.

More information about the Python-list mailing list