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 taleinat
Recipients cheryl.sabella, rhettinger, taleinat, terry.reedy
Date 2019-08-12.06:52:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565592773.8.0.657523892243.issue37827@roundup.psfhosted.org>
In-reply-to
Content
IDLE's shell doesn't currently handle \r and \b in any special way; they are written the the Tk Text widget which displays them in strange, system-dependent ways.

These are often used to show continuously updated progress, e.g. in text-based progress bars, without flooding the output, since they allow overwriting previously written output. If we implement handling for \r and \b, progress indicators such as these could finally work properly in IDLE's shell.

To make things worse, Tk's Text widget becomes increasingly slow when it wraps very long lines. IDLE's shell must wrap lines, and is therefore prone to such slowdowns. Attempting to show updating progress info using \r or \b results in such increasingly long lines of output, eventually slowing IDLE's shell down to a crawl. (The recent addition of squeezing of long outputs help for the case of single, very long outputs, but not with many short strings written on a single line.)

As a recent example, the basic Tensorflow tutorial shows such progress information for several of its stages. Due to the lack of handling for these control characters, it is practically unusable in the IDLE shell due to this. See issue #37762 about this.

Since the shell aims to closely emulate using an interactive terminal session, and since showing progress is so common in interactive work, I propose to add special handling of these two control characters in outputs written to the shell window.


Related issues:

#23220: Documents input/output effects of how IDLE runs user code (originally titled "IDLE does not display \b backspace correctly")

#24572: IDLE Text Output With ASCII Control Codes Not Working (marked as duplicate of #23220)

#37762: IDLE very slow due a super long line output in chunks

StackOverflow: what is the difference between cmd and idle when using tqdm? (https://stackoverflow.com/questions/35895864/what-is-the-difference-between-cmd-and-idle-when-using-tqdm)
History
Date User Action Args
2019-08-12 06:52:53taleinatsetrecipients: + taleinat, rhettinger, terry.reedy, cheryl.sabella
2019-08-12 06:52:53taleinatsetmessageid: <1565592773.8.0.657523892243.issue37827@roundup.psfhosted.org>
2019-08-12 06:52:53taleinatlinkissue37827 messages
2019-08-12 06:52:53taleinatcreate