This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients roger.serwy, terry.reedy
Date 2021-11-14.05:48:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636868922.64.0.209297276857.issue45804@roundup.psfhosted.org>
In-reply-to
Content
Thank you Roger.  Good to hear from you.  

https://stackoverflow.com/questions/66286367/why-is-my-function-faster-than-pythons-print-function-in-idle, Feb 2021, was about this issue.  In my answer I verified the claim and then showed in further experiments that batching prints solved the issue.  #43283 added a paragraph to the IDLE doc explaining the problem and suggesting that users could work around it by batching and joining before printing.  Buffering the streams to do so is an appealing alternative.  I intended to make sure that exceptions are completely and not just partly joined and sent in one write.

Some immediate questions:

Can buffering the output streams have any negative consequences.  Does it affect isatty, for instance, or anything checking line buffering?  

In case a user is interactively developing a tkinter GUI, IDLE already runs tcl.update() in a 50 ms after loop.  Could this be used to trigger writes, by calling flush()?

Did you consider using io.TextIOWrapper instead the current TextIOBase as base class for the output classes?

I am guessing that you do not have a python/cpython clone for making PRs.  Tomorrow, I will try to find out how to make apply a .patch file to mine and do so.
History
Date User Action Args
2021-11-14 05:48:42terry.reedysetrecipients: + terry.reedy, roger.serwy
2021-11-14 05:48:42terry.reedysetmessageid: <1636868922.64.0.209297276857.issue45804@roundup.psfhosted.org>
2021-11-14 05:48:42terry.reedylinkissue45804 messages
2021-11-14 05:48:42terry.reedycreate