@@ -716,14 +716,33 @@ In contrast, some system text windows only keep the last n lines of output.
716716A Windows console, for instance, keeps a user-settable 1 to 9999 lines,
717717with 300 the default.
718718
719- Text widgets display a subset of Unicode, the Basic Multilingual Plane (BMP).
720- Which characters get a proper glyph instead of a replacement box depends on
721- the operating system and installed fonts. Newline characters cause following
722- text to appear on a new line, but other control characters are either
723- replaced with a box or deleted. However, ``repr() ``, which is used for
724- interactive echo of expression values, replaces control characters,
725- some BMP codepoints, and all non-BMP characters with escape codes
726- before they are output.
719+ A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints)
720+ in the the BMP (Basic Multilingual Plane) subset of Unicode.
721+ Which characters are displayed with a proper glyph and which with a
722+ replacement box depends on the operating system and installed fonts.
723+ Tab characters cause the following text to begin after
724+ the next tab stop. (They occur every 8 'characters').
725+ Newline characters cause following text to appear on a new line.
726+ Other control characters are ignored or displayed as a space, box, or
727+ something else, depending on the operating system and font.
728+ (Moving the text cursor through such output with arrow keys may exhibit
729+ some surprising spacing behavior.)
730+
731+ .. code-block :: none
732+
733+ >>> s = 'a\tb\a<\x02><\r>\bc\nd'
734+ >>> len(s)
735+ 14
736+ >>> s # Display repr(s)
737+ 'a\tb\x07<\x02><\r>\x08c\nd'
738+ >>> print(s, end='') # Display s as is.
739+ # Result varies by OS and font. Try it.
740+
741+ The ``repr `` function is used for interactive echo of expression
742+ values. It returns an altered version of the input string in which
743+ control codes, some BMP codepoints, and all non-BMP codepoints are
744+ replaced with escape codes. As demonstrated above, it allows one to
745+ identify the characters in a string, regardless of how they are displayed.
727746
728747Normal and error output are generally kept separate (on separate lines)
729748from code input and each other. They each get different highlight colors.
0 commit comments