On 6/3/2013 3:55 AM, Steven D'Aprano wrote:
The sys module defines two hooks that are used in the interactive
interpreter:
* sys.displayhook(value) gets called with the result of evaluating the
line when you press ENTER;
* sys.excepthook(type, value, traceback) gets called with the details of
the exception when your line raises an exception.
Is there a way to hook into the interactive interpreter *before* it is
evaluated? That is, if I type "len([])" at the prompt and hit ENTER, I
want a hook that runs before len([]) is evaluated to 0, so that I get the
string "len([])".
You have not said what you are actually trying to do, but you could
definitely modify Idle to do something with user input before it sends
it to the user process.
--
http://mail.python.org/mailman/listinfo/python-list