
On Fri, 16 Oct 2020 at 20:43, Jonathan Crall <erotemic@gmail.com> wrote:
@Chris Angelico If you are more application focused, or trying to get a scientific result, and you don't care too much about the reusability of your scripts, then I can see the validity of this use case. But I would not want to install a module on pypi that made use of this. From a software perspective this is 100% bad practice, but from a practitioner perspective --- and there are a lot of practitioners that only use Python as a tool (like a DSL) --- I can see wanting it.
So, that's the question: does the Python stdlib want to let you do this? Will the number of software engineers who use this incorrectly outweigh the number of people who seem to want this for a valid reason? I'm not sure what the answer is.
FWIW executing `print('\x1b[H\x1b[2J\x1b[3J')` in my IPython terminal cleared the screen.
Why would you want to put this in your script, so that you have no choice (short of editing the script) as to whether it happens? Surely better to clear your terminal from the command prompt *before* running your script? Yes, you can forget, but I'd rather forget occasionally than lose essential data because I ran a script that I'd forgotten has an os.clear() at the top... I suspect Guido's right, it's asked for often enough, and fiddly enough to write, that adding it is a net gain. But I'd be very unlikely to use it myself, and I'd strongly advise people against using it if asked. Paul