(3.2) Overload print() using the C API?

Terry Reedy tjreedy at udel.edu
Fri Apr 27 13:27:25 EDT 2012


On 4/27/2012 4:55 AM, Stefan Behnel wrote:

>> I want the script
>> itself to update a window in the host application (via the extension) every
>> time the script calls print().
>
> Then replace sys.stdout (and maybe also sys.stderr) by another object that
> does what you want whenever its write() method is called.

This is essentially what Idle does to display python output to its window.
 >>> import sys; sys.stdout
<idlelib.rpc.RPCProxy object at 0x0000000003250AC8>

-- 
Terry Jan Reedy




More information about the Python-list mailing list