[Tutor] Can a python program access the python interpreter?

Carnell, James E jecarnell at saintfrancis.com
Fri Sep 28 21:00:20 CEST 2007


Let's say I have a program that is learning how to find patterns in a
list etc.

list = [1,2,3,5,8,13]

So the python program (Kitty.py) opens the python interpreter and copies
this list to it.

It then can try some pattern finding things it already has stored
(PositionN+1 - PositionN etc.)
 That would be nice.

As it stands I have to program all these rules (like Kitty.py typing
nonsensical commands, or going outside the array) when the interpreter
already has all these rules. I can just insert Kitty.py's "junk" into
try exception handling... I don't know how to make this easier.

Maybe I just need to get the program out of the computer so that it can
use the interpreter. Hey, maybe that portable python... Hmmm.... Any
other ideas (I only have Internet at work, and I.T. would hack up a hair
ball if I tried to do this here).

James Carnell



More information about the Tutor mailing list