I searched my own email archives and found that this is indeed frequently requested for IDLE. For example, Raymond Hettinger filed *two* different bug reports about it on behalf of his students, both closed as duplicates of https://bugs.python.org/issue6143, which has been open with frequent discussion since 2009 (!).

I also found several other requests for this, e.g. one from this August in idle-dev, one from August 2018 in core-mentorship, another from August 2017 in idle-dev, and a long python-ideas thread from October 2016. (What is it with August? I really do think this is a "new student" thing...)

One reason it's important for IDLE is that IDLE's shell window slows down as its buffer gets longer, and it cannot easily be emptied (it's uneditable). And in IDLE, none of the solutions that print escape sequences work, because IDLE's shell window is not a terminal emulator.

Outside IDLE, the main problem seems to be that few people know enough to figure out it's a simple escape sequence, and the system commands vary by system (on my Mac it's "clear" and it prints ESC [ H ESC [ 2 J).

Let's add a function os.clear(), and perhaps IDLE (or some enterprising IDLE hacker) can monkey-patch that to do whatever makes IDLE's shell reset.

On Thu, Oct 15, 2020 at 4:52 PM Mike Miller <python-ideas@mgmiller.net> wrote:

On 2020-10-13 15:35, Guido van Rossum wrote:
> Can one of the educators on the list explain why this is such a commonly
> required feature? I literally never feel the need to clear my screen -- but I've
> seen this requested quite a few times in various forms, often as a bug report
> "IDLE does not support CLS". I presume that this is a common thing in other
> programming environments for beginners -- even C++ (given that it was
> mentioned). Maybe it's a thing that command-line users on Windows are told to do
> frequently? What am I missing that students want to do frequently? Is it a
> holdover from the DOS age?


Not Windows specific, no.  I've never thought of it as beginner-specific either.
  It's an ANSI standard terminal feature that existed beforehand, right?  My
knowledge before that is limited.

Why?  It's mostly about focus I suppose.  Commonly used when switching to a new
task, logging out for security reasons, or perhaps when there are several
terminals on screen at once which have not been used in a while.  Stale output
is no longer relevant and becomes visual clutter.

I use it most often when there's a ton of debug log messages from a service.
This makes the scrollbar more useful because (cleared beforehand) output now
represents 100% of the scrollback when needing to pinpoint a problem at a
particular time.

So I believe there's room for terminal functionality in Python between "dumb"
output and a full screen TUI, such as would be used in a wizard-type program, or
clearing before printing a current status.

In terms of common use, I'd guess it has something to do with one's personality.
  What does your desk look like right now?  Piles of papers everywhere, or neat
as a pin minimalism?  A spectrum of folks exist and are good contributors.

A few other folks commented that they don't use it.  I've personally never used
a number of features in the stdlib either.  However, this one is simple to
implement and commonly expected.

-Mike
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6WU7UHCMS5BEX3ZVY7U55BUNHKJQ6M7N/
Code of Conduct: http://python.org/psf/codeofconduct/


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)