eval or execute, is this the (most) correct way ?
stef.mientki at gmail.com
Mon Aug 11 19:47:19 CEST 2008
Steven D'Aprano wrote:
> 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.
sorry, but that confuses me even more,
I don;t have a file / module,
just a workspace and one or more lines of code in memory.
> Try running "python -m code"
> at a regular shell (not the Python shell, your operating system's shell).
I might have been not clear enough,
I'm trying to build an python-IDE,
so I definitely want to run code from memory.
> 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