Interpretor.

Mark 'Kamikaze' Hughes kamikaze at kuoi.asui.uidaho.edu
Wed Oct 27 17:25:58 CEST 2004


Balaji <balaji at email.arizona.edu>
wrote on 26 Oct 2004 15:10:14 -0700:
> Hello Everyone....
> I have created a simple GUI using wx python. Its an simple editor...
> Now what I want to do is pass the contents of this editor and receive
> solution from python.
> Suppose in the editor if I say x=2 and y=3 and then x+y I should get
> back the solution.
> In general i want to build an simple interpretor..
> Any ideas....

  You already have one: Python!

>>> s = """x=2
... y=3
... rc=x+y"""
>>> exec(s)
>>> rc
5

-- 
 <a href="http://kuoi.asui.uidaho.edu/~kamikaze/"> Mark Hughes </a>
"I think [Robert Heinlein] would take it kindly if we were all to refrain from
 abandoning civilization as a failed experiment that requires too much hard
 work." -_Rah, Rah, RAH!_, by Spider Robinson



More information about the Python-list mailing list