I occasionally find it useful to clear the screen when doing demos/presentations. I think the case for it is clear (hah) enough based on its long history and presence in many terminal emulators. But then again, the terminals I use and readline support it already, so I don't need python repl  to do it for me.

+1 on having it. -1 on doing it in Python, per se. net +0.

On Tue, Oct 13, 2020 at 19:12 David Mertz <mertz@gnosis.cx> wrote:
I teach a lot.  But it's adults, and ones who have at least a little bit of programming experience (perhaps in a different language, but something).

I've never had anyone request a "clear screen" command.  Of course, I usually use Jupyter notebooks for teaching, so I'm not sure what that would mean there anyway.  But it definitely feels like a UI thing, not a PL thing.  About 30 seconds ago, I typed `%clear` in IPython... I'm not certain it is the first time I've ever done so, but quite likely.  It was amazing, my screen was cleared :-).

On Tue, Oct 13, 2020 at 6:38 PM Guido van Rossum <guido@python.org> 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?

On Tue, Oct 13, 2020 at 11:25 AM Mike Miller <python-ideas@mgmiller.net> wrote:

On 2020-10-13 06:19, Stestagg wrote:
> For example, the pypi `console` library provides a method: `console.sc.reset()`
> that behaves similarly to `CLS` on windows and also appears to be fairly
> reliable cross-platform.


Yes, there is more to it than appears at first glance.  There is resetting the
terminal, clearing the currently visible screen, and/or the scrollback buffer as
well.

The legacy Windows console has another limitation in that I don't believe it has
a single API call to clear the whole thing.  One must iterate over the whole
buffer and write spaces to each cell, or some similar craziness.  That's why
even folks writing C++ just punt and do a system("cls") instead.

With the mentioned lib console, the example above prints the ANSI codes to do a
terminal reset, and while that works widely these days, it should not be the
first choice.  It would be better to use the cross-platform wrapper functions in
the console.utils module, either:

     # A DOS-like reset, clears screen and scrollback, also aliased to cls()
     reset_terminal()

     # A Unix-like clear, configurable via param, and aliased to clear()
     clear_screen()

-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/MX54AOXMYJHGRVOO2XW3J7JWHQDDUKPQ/
Code of Conduct: http://python.org/psf/codeofconduct/


--
--Guido van Rossum (python.org/~guido)
_______________________________________________
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/J65P6UELD4RSSCSMAFYF52WADURHX2HL/
Code of Conduct: http://python.org/psf/codeofconduct/


--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.
_______________________________________________
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/Q6NTJLEPOTULRKE6WKJGXG4W7NMST7VU/
Code of Conduct: http://python.org/psf/codeofconduct/