an eval()-like exec()

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Aug 28 01:05:23 EDT 2007


En Mon, 27 Aug 2007 15:59:25 -0300, Abel Daniel <abli at freemail.hu>  
escribi�:

> Hi!
>
> A python interactive interpreter works by having the user type in some
> code, compiling and running that code, then printing the results. For
> printing, the results are turned into strings.

This last stage is done by calling sys.displayhook - you can replace that  
function with your own one, and get the object to be printed.
Any of your previous attempts (using compile(...,"single")+eval, using  
exec, or creating your own code.InteractiveInterpreter) should work with  
this.

-- 
Gabriel Genellina




More information about the Python-list mailing list