I'm trying to make an editor with an integrated Shell.
2+5>>So when type:
7>>I want the answer on the next line:
myvar = 55>>When I type:
myvar
55>>I want the value of myvar:
So AFAIK, sometimes I've to use eval and sometimes I need exec,
so I use the following code (global / local dictionary parameters are
left out in this example):
try:
print eval ( line )
except :
exec ( line )
Is this the (most) correct / elegant way, or are there better solutions ?
I read somewhere that exec is going to disappear,
and noticed that in 2.5 (I just updated to) the doc is already disapeared,
is this no longer possible in Python 3 ?
thanks,
Stef Mientki