View Single Post
  #1   Spotlight this post!  
Unread 17-09-2012, 17:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,024
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
"compiler" constants


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:

Code:
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?


Reply With Quote