Not an educator, but since no-one seems to have mentioned this: I often use
"os.system('clear')" for quick and dirty terminal animations, eg. to debug
a maze solver for some competitive coding challenge... Not much of a use
case, and doesn't really matter if it's not portable.

On Tue, 13 Oct 2020 23:36 Guido van Rossum, <gu...@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-id...@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-le...@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)
> *Pronouns: he/him **(why is my pronoun here?)*
> <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@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/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@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/BNGLHZNXF5KAEPSAXFYNDLCI554VHMRD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to