On Sat, Dec 19, 2020 at 8:53 PM Guido van Rossum <guido@python.org> wrote:
at sounds like a very special status. Why not os.clear()?

I do agree with the motivation for doing this. (I've started doing more exploratory programming and I've felt this need clearly a few times.)

Frankly, you can't do hardly any scripting without importing at least os or sys anyway. And "scripting" environments could pre-import whatever they want.

I can't comment on the exact semantics or implementation (though I'd prefer it if it didn't have to run a subprocess).

IDLE should probably monkey-patch this so it does something reasonable in its shell window.

I'm not sure if there's anything to do to make that easier, but it would be good if it were easy for any terminal emulator in IDEs, etc to have it to hook into. 

I also have no idea about implementation, but I"m sure there's a few folks with platform expertise that could make this work on many systems out of the box.

This SO post: (https://stackoverflow.com/questions/55771796/how-to-clear-the-screen-of-interactive-ipython-console-from-python-code) both provided one more data point about folks wanting this, and a pointer to the fact that iPython already includes something -- though I just found that code, and it's no fancier than what my student came up with:

if os.name == 'posix':
    def _term_clear():
        os.system('clear')
elif sys.platform == 'win32':
    def _term_clear():
        os.system('cls')
else:
    def _term_clear():
        pass


(https://github.com/ipython/ipython/blob/master/IPython/utils/terminal.py)

is it so bad to use a subprocess?

-CHB

--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython