Ether
17-09-2012, 17:16
New to Python. Have what I hope is a simple question.
I realize Python is interpreted, but I was wondering if there is something in Python equivalent to "compiler constants".
To illustrate with a very simple example, suppose I have a function:
def MyFunc(x)
return a*x^2 + b*x + c
... and I want to pass this function as an argument to a library function which is expecting only one argument (i.e "x").
Can I assign constant values to "a" "b" and "c" and have the interpreter literally replace all occurrences with the numerical values?
I realize Python is interpreted, but I was wondering if there is something in Python equivalent to "compiler constants".
To illustrate with a very simple example, suppose I have a function:
def MyFunc(x)
return a*x^2 + b*x + c
... and I want to pass this function as an argument to a library function which is expecting only one argument (i.e "x").
Can I assign constant values to "a" "b" and "c" and have the interpreter literally replace all occurrences with the numerical values?