Interactive loop with InteractiveInterpreter

Tim Gahnström /Bladerman tim at bladerman.com
Fri Apr 4 09:02:12 EST 2003


"Tim Gahnström /Bladerman" <tim at bladerman.com> wrote

> 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?

Hmm replying to myself here but I just figgured out a way that maybe is
good... or bad... ad an extra layer before I call

    InteractiveInterpreter.runcode()

If I am about to send a for statement or a while statement to the
interpreter I skip that line and set up my own loop with the parameters from
the the loopline and then feed each line to the interpreter several times,
handling the looping myself.

It seems like an awkward way but I guess it is possible.

Or am I maybe better of using the debuggermodule, I just remembered it and
havn't had a look at it yet, is this maybe what it is intended for?

Tim






More information about the Python-list mailing list