Interactive loop with InteractiveInterpreter

Tim Gahnström /Bladerman tim at bladerman.com
Fri Apr 4 07:53:57 EST 2003


I am trying to make an interactive interpreter for python source code.

It is all fun and games with Interactiveinterpreter.runcode() as long as it
is simple statements like

print "hello"
print "world"

Then I can feed it one line at the time and probably highlight the actuall
line in the editor but when it comes to a  loop I must feed runcode the
whole statement, the whole loop.

for i in list:
    print i

The above can be feed to runcode but I want to step trough the list and se
each printing operation not all at once.

Is it possible to step through a loop at all? With interactive interpreter?
I can't seem to find an easy solution, I guess InteractiveConsole won't do
it either. Is it maybe better to do it in a completley different way?


Any ideas or suggestions are welcome.

Thanks

Tim






More information about the Python-list mailing list