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

Peter Faulks faulksp at iinet.net.au
Thu Apr 26 13:57:50 EDT 2012


G'day,


I want to extend an embedded interpreter so that calls to print() are 
automagically sent to a C++ gui (windows exe) via a callback function in 
the DLL.

Then I'll be able to do this:

----test.py----
import printoverload

printoverload.set_stdout()
printoverload.set_stderr()

print("this will be sent to a C function in printoverload.pyd")
---------------


Is this feasible?
Any gotchas I should be aware of?


Cheers








More information about the Python-list mailing list