<div dir="ltr"><br><br>On Tuesday, November 29, 2016 at 4:08:19 AM UTC-5, Victor Stinner wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi,
<br>
<br>Python is optimized for performance. Formatting an error message has a
<br>cost on performances.
<br>
<br></blockquote><div><br></div><div>Usually, when an exception is hit that will (probably) crash the program, no one cares about less than a microsecond of performance.</div><div> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I suggest you to teach your student to use the REPL and use a custom
<br>exception handler: sys.excepthook:
<br><a href="https://docs.python.org/2/library/sys.html#sys.excepthook" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F2%2Flibrary%2Fsys.html%23sys.excepthook\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEt8gXHQYu_aWDVOiN6xhhVf8sOyw';return true;" onclick="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.python.org%2F2%2Flibrary%2Fsys.html%23sys.excepthook\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEt8gXHQYu_aWDVOiN6xhhVf8sOyw';return true;">https://docs.python.org/2/<wbr>library/sys.html#sys.<wbr>excepthook</a>
<br>
<br>Using a custom exception handler, you can run expensive functions,
<br>like the feature: "suggest len when length is used".
<br>
<br>The problem is then when students have to use a Python without the
<br>custom exception handler.
<br>
<br>Victor
<br>______________________________<wbr>_________________
<br>Python-ideas mailing list
<br><a href="javascript:" target="_blank" gdf-obfuscated-mailto="yvRHgUAIBwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">Python...@python.org</a>
<br><a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;" onclick="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a>
<br>Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;">http://python.org/psf/<wbr>codeofconduct/</a>
<br></blockquote></div>