I just want to point out that I can think of a valid use case for `clf`.
I'm not sure if it was mentioned.

In the case where you have a script that produces a lot of output, a common
task might be scrolling to the beginning to check an output. If your screen
was not fresh, and you had a lot of previous output (say from running the
script multiple times), then it is hard to find the beginning unless you
have previously cleared the screen.

If you have cls, you can ensure that your big crazy
undergrad-programming-level script always clears the screen when it runs.
Maybe that helps you get your homework in on time. There is a task you
commonly do (clear the screen via cls or clear) programatically in python.

You may say: why are you not using logging? Well, perhaps --- because it
seems it is typically students who want to do this --- perhaps they don't
know how to do logging, or have doubts that they know how to do it
properly.

It seems that something like this might be better as a third party library,
given that it's more of a stdout + console specific thing. But on the other
hand this isn't much worse than `os.startfile` on windows.



On Fri, Oct 16, 2020 at 1:21 PM David Mertz <me...@gnosis.cx> wrote:

> I agree with Guido here.  Although I really don't care about the
> capability myself, it feels like enough people do want a "clear screen"
> function... and from the discussion, in feels like there are a LOT of
> variations in how to do it across different operating systems, OS versions,
> terminals, shells, etc.
>
> Having a common interface of `os.clear()` that did whatever funny thing a
> particular environment needed would save some folks trouble.  Of course,
> I'm not certain how far it is possible to auto-detect the environment
> details within that function to "do the right thing" ... but probably there
> are clever hacks that get to 90% working.
>
> On Fri, Oct 16, 2020 at 1:03 PM Rob Cliffe via Python-ideas <
> python-ideas@python.org> wrote:
>
>>
>>
>> On 16/10/2020 13:55, Chris Angelico wrote:
>> > On Fri, Oct 16, 2020 at 11:08 PM Rob Cliffe <rob.cli...@btinternet.com>
>> wrote:
>> >>
>> >>
>> >> On 16/10/2020 11:59, Chris Angelico wrote:
>> >>> On Fri, Oct 16, 2020 at 8:21 PM Rob Cliffe via Python-ideas
>> >>> <python-ideas@python.org> wrote:
>> >>>>
>> >>>> On 13/10/2020 23: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?
>> >>>>>
>> >>>> Sometimes I want a program that displays (more than 1 line of)
>> real-time
>> >>>> information in a Windows CMD box and refreshes it every few seconds
>> >>>> (e.g. progress displays, monitoring open
>> >>>> files/locks/connections/downloads etc.).  It is natural to clear the
>> >>>> screen and display the updated information.
>> >>> Natural perhaps, but ugly. Much better to reposition the cursor and
>> >>> overwrite the previous text, with "clear to end of line" as required;
>> >>> that way, you avoid flicker.
>> >>>
>> >>> C
>> >> I do precisely that in many of my programs for e.g. single-line
>> progress
>> >> displays.
>> >> But for multi-line output I don't know of any way to move the cursor
>> >> back up.
>> >> I work in Windows 10.
>> > Try \x1b[A to move up a line, should work.
>> >
>> > ChrisA
>> Thanks Chris, but no luck.  It just echoes it, with the \x1b (Escape)
>> echoed as a character that looks like a question mark inside a box.
>> Earlier I did try googling for ways of moving the cursor, but almost all
>> I found was ways of moving the *mouse* cursor, and the rest was
>> irrelevant.
>> Rob Cliffe
>> > _______________________________________________
>> > 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/5VZGBRIEW5UPQ6VCYQXC3UUNNHQXNFRB/
>> > 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/5SBLJZAT3CH35ILXLSCLX5R62BQX3FQE/
>> 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-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/3O4AQ2GX5UXYOLULBKOX5ZVSF2QN3KMS/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
-Dr. Jon Crall (him)
_______________________________________________
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/ZUA247SPGGSA7SUKGKGVTR3XMQMY4XN7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to