From andre.roberge at gmail.com Wed Feb 10 10:33:20 2021 From: andre.roberge at gmail.com (=?UTF-8?Q?Andr=C3=A9_Roberge?=) Date: Wed, 10 Feb 2021 11:33:20 -0400 Subject: [Idle-dev] excepthook experiments with IDLE and Friendly-traceback Message-ID: Hello everyone, The latest Python version (3.10.a5) of IDLE's repl has support for user-defined exception hooks. After being contacted by Terry Reedy about this feature, I investigated integrating Friendly-traceback [1] with IDLE. For those that are interested, I have documented on github [2] (with screenshots) how Friendly-traceback works with IDLE, including some limitations. Feel free to comment on that issue for any suggestion you might have about possible improvements to Friendly-traceback, including the current API used. In some cases, I determine based on Python's version whether or not a feature can be enabled. I consider this to be brittle. Rather than relying on Python's version, I would much prefer if I could be able to write something like: try: from idlelib import support_excepthook except: support_excepthook = False This would be especially useful if this support for user-defined exception hooks within IDLE's shell is backported to older versions of Python. Something similar would also be useful if and when support for custom handling of SyntaxError is added to IDLE. Best, Andr? Roberge [1] https://aroberge.github.io/friendly-traceback-docs/docs/html/ Currently, the documentation does not include the new IDLE-related features. [2] https://github.com/aroberge/friendly-traceback/issues/183 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andre.roberge at gmail.com Wed Feb 10 13:52:31 2021 From: andre.roberge at gmail.com (=?UTF-8?Q?Andr=C3=A9_Roberge?=) Date: Wed, 10 Feb 2021 14:52:31 -0400 Subject: [Idle-dev] About extensions ... New: excepthook experiments with IDLE and Friendly-traceback In-Reply-To: <009aafbc-2a0c-916f-cd45-00c08fce45f0@udel.edu> References: <009aafbc-2a0c-916f-cd45-00c08fce45f0@udel.edu> Message-ID: Apologies if you receive this message twice. I sent an email a few hours ago but I have not seen any sign of it in the idle-dev archive. From past experience, I do not recall messages to idle-dev being moderated, so I decided to reply to an older message in this second attempt. = = = Hello everyone, The latest Python version (3.10.a5) of IDLE's repl has support for user-defined exception hooks. After being contacted by Terry Reedy about this feature, I investigated integrating Friendly-traceback [1] with IDLE. For those that are interested, I have documented on github [2] (with screenshots) how Friendly-traceback works with IDLE, including some limitations. Feel free to comment on that issue for any suggestion you might have about possible improvements to Friendly-traceback, including the current API used. In some cases, I determine based on Python's version whether or not a feature can be enabled. I consider this to be brittle. Rather than relying on Python's version, I would much prefer if I could be able to write something like: try: from idlelib import support_excepthook except: support_excepthook = False This would be especially useful if this support for user-defined exception hooks within IDLE's shell is backported to older versions of Python. Something similar would also be useful if and when support for custom handling of SyntaxError is added to IDLE. Best, Andr? Roberge [1] https://aroberge.github.io/friendly-traceback-docs/docs/html/ Currently, the documentation does not include the new IDLE-related features. [2] https://github.com/aroberge/friendly-traceback/issues/183 > > > _______________________________________________ > IDLE-dev mailing list > IDLE-dev at python.org > https://mail.python.org/mailman/listinfo/idle-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Sun Feb 21 17:42:56 2021 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 21 Feb 2021 17:42:56 -0500 Subject: [Idle-dev] IDLE doc addition: print speed & workaround Message-ID: https://stackoverflow.com/questions/66286367/why-is-my-function-faster-than-pythons-print-function-in-idle The question and my answer reports experiment on why IDLE print speed is sometimes slow and how to make it faster. https://github.com/python/cpython/pull/24615 proposes to add the following to the IDLE doc. Sending print output from one process to a text widget in another is slower than printing to a system terminal in the same process. This has the most effect when printing multiple arguments, as the string for each argument, each separator, the newline are sent separately. For development, this is usually not a problem, but if one wants to print faster in IDLE, format and join together everything one wants displayed together and then print a single string. Both format strings and ``separator.join`` can help combine fields and lines. I plan to wait a couple of days for comments before merging. -- Terry Jan Reedy