Providing Python scripting to a Python application

Erik Max Francis max at alcyone.com
Fri Dec 27 07:33:19 EST 2002


Satheesh Babu wrote:

> At the moment, I store this "script" in a Python class and then
> execute it
> by eval()-uating functions. What I would love to do is to add normal
> Python constructs like if-else, for, while etc.

If you're just using eval, then use use it in conjunction with exec. 
eval is for expressions, exec is for statements.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ There is nothing stronger in the world than gentleness.
\__/ Han Suyin
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.



More information about the Python-list mailing list