Ezio Melotti <ezio.melo...@gmail.com> added the comment: In the first message I said that this breaks the PEP3138 because I thought that the solution was to change the default error-handler to 'backslashreplace', but this was already proposed and refused.
sys.displayhook provides a way to change the behavior of the interactive interpreter only when ">>> foo" is used. The PEP doesn't seem to say anything about how ">>> foo" should behave. Moreover, in the alternate solutions [1] they considered to use sys.displayhook (and sys.excepthook) but they didn't because "these hooks are called only when printing the result of evaluating an expression entered in an interactive Python session, and doesn't work for the print() function, for non-interactive sessions or for logging.debug("%r", ...), etc." This is exactly the behavior I intended to have, and, being a unique feature of the interactive interpreter, it doesn't lead to inconsistence with other situations. [1]: http://www.python.org/dev/peps/pep-3138/#alternate-solutions ---------- nosy: +atsuoi _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5110> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com