aph wrote:
> actually 'exec()' is the function I was looking for. Working code:
> 
> class myApp:
> 
>     def kalle(self,str):
>         return str.upper()
> 
>     def run_script(self,script):
>         exec(script)
> 
> app = myApp()
> app.run_script("print self.kalle('hello')")

A very minor point, but perhaps in some circumstances it could make a 
difference: exec is a statement, not a function.  No need to pass the 
argument(s) in parentheses, and of course there's no return value.

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to