eval or execute, is this the (most) correct way ?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Aug 11 18:33:42 CEST 2008

On Mon, 11 Aug 2008 17:26:56 +0200, Stef Mientki wrote:

> I'm trying to make an editor with an integrated Shell.
> Is this the (most) correct / elegant way, or are there better solutions
> ?

The best solution is not to re-invent the wheel: "import code" is the way 
to emulate Python's interactive interpreter. Try running "python -m code" 
at a regular shell (not the Python shell, your operating system's shell).

Doing a search of the file code.py, I don't find the string "eval" at 
all. My guess is that your approach is probably not the best way.


More information about the Python-list mailing list