Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-10-04 Thread eryk sun
On Tue, Oct 4, 2016 at 2:22 PM, Random832 wrote: > On Wed, Sep 28, 2016, at 23:36, Chris Angelico wrote: >> On Thu, Sep 29, 2016 at 12:04 PM, Steven D'Aprano >> wrote: >> > (Also, it seems a shame that Ctrl-D is EOF in Linux and Mac, but Windows >> >

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-10-04 Thread Random832
On Wed, Sep 28, 2016, at 23:36, Chris Angelico wrote: > On Thu, Sep 29, 2016 at 12:04 PM, Steven D'Aprano > wrote: > > (Also, it seems a shame that Ctrl-D is EOF in Linux and Mac, but Windows > > is Ctrl-Z + Return. Can that be standardized to Ctrl-D everywhere?) > > Sadly,

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread Stephan Houben
Hi JM, Windows 7 Enterprise "Microsoft Windows [Version 6.1.7601]" I am running Python directly from the shortcut created on installation. But starting it from cmd.exe has the same effect. Codepage is 437 , this may be relevant? I just tried it on a Windows 10 PC, there it has the same effect.

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread João Matos
Hello, I tried on Python 2.7.10 and Python 3.5.2 and Ctrl-L doesn't work on both. I tried on 2 PCs with Windows 7 and none of them worked. What is your Windows version? Are you trying on the cmd.exe console or PS? Best regards, JM quinta-feira, 29 de Setembro de 2016 às 08:09:13 UTC+1,

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread eryk sun
On Thu, Sep 29, 2016 at 7:08 AM, Stephan Houben wrote: > > I just tried with this official Python binary: > Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit > (Intel)] on win32 > > and CTRL-L for sure does clear the window. It just doesn't then

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread Paul Moore
On 29 September 2016 at 08:08, Stephan Houben wrote: > I just tried with this official Python binary: > Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit > (Intel)] on win32 > > and CTRL-L for sure does clear the window. It just doesn't then move

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread Stephan Houben
Hi all, I just tried with this official Python binary: Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 and CTRL-L for sure does clear the window. It just doesn't then move the prompt to the top, so you end up with a bunch of empty lines, followed by

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-29 Thread João Matos
Hello, Yes, Ctrl-L doesn't clear the screen on Windows. Making Ctrl-L clear the screen would be a good solution (no need for a clear screen command). Best regards, JM quinta-feira, 29 de Setembro de 2016 às 03:06:26 UTC+1, Steven D'Aprano escreveu: > On Tue, Sep 27, 2016 at 10:05:16AM

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-28 Thread אלעזר
"Bash on Ubuntu on windows" responds to CTRL+D just fine. I don't really know how it works, but it looks like it is based on the Windows terminal emulator. Elazar בתאריך יום ה׳, 29 בספט' 2016, 06:36, מאת Chris Angelico ‏: > On Thu, Sep 29, 2016 at 12:04 PM, Steven D'Aprano

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-28 Thread Oleg Broytman
On Thu, Sep 29, 2016 at 12:04:28PM +1000, Steven D'Aprano wrote: > (Also, it seems a shame that Ctrl-D is EOF in Linux and Mac, but Windows > is Ctrl-Z + Return. Can that be standardized to Ctrl-D everywhere?) I don't think consistency should go that far. Consistency

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-28 Thread Steven D'Aprano
On Tue, Sep 27, 2016 at 10:05:16AM -0700, João Matos wrote: > Hello, > > > It doesn't work in Windows. What is "it"? Are you talking about Ctrl-L to clear the screen? Perhaps we should start by adding Ctrl-L as a standard way to clear the Python REPL, in the same way that Ctrl-C is the

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-27 Thread João Matos
Hello, It doesn't work in Windows. Best regards, JM terça-feira, 27 de Setembro de 2016 às 16:40:42 UTC+1, Dennis Brakhane via Python-ideas escreveu: > I don't know if it works on Windows, but at least in Linux pressing > Ctrl-L will do exactly what you describe (as long as the REPL uses

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread Greg Ewing
Terry Reedy wrote: In the default mode with user code executed in a separate no-window process, there is currently no way for the child process to know the current size of Shell's tk text window in the parent process. On unix it should be possible to let the child know if it's connected

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread Terry Reedy
On 9/20/2016 9:31 AM, Steven D'Aprano wrote: On Mon, Sep 19, 2016 at 06:18:38AM -0400, Terry Reedy wrote: On 9/19/2016 4:31 AM, Paul Moore wrote: shutil.get_terminal_size() is available on all platforms. On windows, it works with Command Prompt and PowerShell but fails in IDLE, as it must.

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread Steven D'Aprano
On Mon, Sep 19, 2016 at 06:18:38AM -0400, Terry Reedy wrote: > On 9/19/2016 4:31 AM, Paul Moore wrote: > > >shutil.get_terminal_size() is available on all platforms. > > On windows, it works with Command Prompt and PowerShell but fails in > IDLE, as it must. Why "must" it fail? What is it

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread Michel Desmoulin
+1 for this. I regularly miss this feature. Le 17/09/2016 à 13:12, João Matos a écrit : > Hello, > > In other interpreted programming languages the clear screen command > (whatever it is) also does not clear the session. > It just clears the screen clutter. > > As I said, this would be very

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread Chris Angelico
On Tue, Sep 20, 2016 at 6:20 PM, Paul Moore wrote: > There > have been occasional deviations from this (for example, the "as" in > "import foo as bar" was, for a time, only a keyword in that specific > context) but I don't believe any of them survived long-term. async and

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread אלעזר
On Tue, Sep 20, 2016 at 4:56 AM Steven D'Aprano wrote: > On Mon, Sep 19, 2016 at 01:35:53PM -0700, João Matos wrote: > > Hello, > > > > I don't see why creating a clear command would interfere with > dict.clear() > > which is a function/method. > > For the same reason that

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-20 Thread João Matos
Hello, You are correct. Thanks for the explanation. Best regards, JM terça-feira, 20 de Setembro de 2016 às 02:56:57 UTC+1, Steven D'Aprano escreveu: > On Mon, Sep 19, 2016 at 01:35:53PM -0700, João Matos wrote: > > Hello, > > > > I don't see why creating a clear command would interfere

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Steven D'Aprano
On Mon, Sep 19, 2016 at 01:35:53PM -0700, João Matos wrote: > Hello, > > I don't see why creating a clear command would interfere with dict.clear() > which is a function/method. For the same reason that you can't have a method called foo.while or foo.if or foo.raise. If clear is a "command" (a

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Paul Moore
On 19 September 2016 at 21:35, João Matos wrote: > Hello, > > I don't see why creating a clear command would interfere with dict.clear() > which is a function/method. > > Although my first idea was a clear command, I have no problem if it is a > clear() function from site.py.

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread João Matos
Hello, I don't see why creating a clear command would interfere with dict.clear() which is a function/method. Although my first idea was a clear command, I have no problem if it is a clear() function from site.py. I didn't suggest cls because it is normally used to mean class. I use Windows

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread eryk sun
On Mon, Sep 19, 2016 at 1:12 PM, Paul Moore wrote: > By the way - if you're on a system with readline support included with > Python, GNU readline apparently has a binding for clear-screen > (CTRL-L) so you may well have this functionality already (I don;'t use > Unix or

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Paul Moore
On 19 September 2016 at 13:10, Paul Moore wrote: > > For this particular suggestion, though, I don't think that's the case. > I think it's going to either be something that's accepted into the > stdlib, or something that's rejected as too platform-specific or messy > to

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Chris Angelico
On Mon, Sep 19, 2016 at 9:56 PM, Steven D'Aprano wrote: > On Mon, Sep 19, 2016 at 06:38:00PM +1000, Chris Angelico wrote: > >> Sounds good to me. This is definitely sounding complicated and messy >> enough to justify (a) writing a function to clear the screen, and (b) >>

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Paul Moore
On 19 September 2016 at 12:56, Steven D'Aprano wrote: > > For relatively small pieces of functionality, if it is useful enough, we > should just add it to the std lib, and if it isn't, we should just say > it isn't useful enough. We shouldn't condemn supporters of the idea to

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Steven D'Aprano
On Mon, Sep 19, 2016 at 06:38:00PM +1000, Chris Angelico wrote: > Sounds good to me. This is definitely sounding complicated and messy > enough to justify (a) writing a function to clear the screen, and (b) > testing that function thoroughly as a PyPI module before pushing > anything into the

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Terry Reedy
On 9/19/2016 4:31 AM, Paul Moore wrote: shutil.get_terminal_size() is available on all platforms. On windows, it works with Command Prompt and PowerShell but fails in IDLE, as it must. In the absence of knowledge, it guesses the default of 80 x 24 (as documented). AFAIK, there is no way

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Chris Angelico
On Mon, Sep 19, 2016 at 6:31 PM, Paul Moore wrote: > On 19 September 2016 at 03:40, Chris Angelico wrote: >> On Mon, Sep 19, 2016 at 12:32 PM, Steven D'Aprano >> wrote: >>> (The fallback if all else fails is easy: get the height of

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-19 Thread Paul Moore
On 19 September 2016 at 03:40, Chris Angelico wrote: > On Mon, Sep 19, 2016 at 12:32 PM, Steven D'Aprano wrote: >> (The fallback if all else fails is easy: get the height of the terminal, >> in lines, and print that many blank lines.) > > Assuming you can

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-18 Thread Stephen J. Turnbull
Chris Angelico writes: > On Mon, Sep 19, 2016 at 12:32 PM, Steven D'Aprano > wrote: > > (The fallback if all else fails is easy: get the height of the terminal, > > in lines, and print that many blank lines.) > > Assuming you can get the height in lines. Have you

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-18 Thread Chris Angelico
On Mon, Sep 19, 2016 at 12:32 PM, Steven D'Aprano wrote: > (The fallback if all else fails is easy: get the height of the terminal, > in lines, and print that many blank lines.) Assuming you can get the height in lines. Have you tried that in the default Windows shell? I

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-18 Thread Steven D'Aprano
On Sat, Sep 17, 2016 at 11:51:16AM +0100, João Matos wrote: > Hello, > > I would like to suggest adding a clear command (not function) to Python. While technically "clear" could be a command, I think it should not be. First off, making clear a reserved keyword, and a statement, like print in

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-17 Thread Terry Reedy
On 9/17/2016 6:51 AM, João Matos wrote: Hello, I would like to suggest adding a clear command (not function) to Python. It's simple purpose would be to clear the REPL screen, leaving the >>> prompt at the top left of the screen. This is something very basic but also very useful for newbies

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-17 Thread eryk sun
On Sat, Sep 17, 2016 at 1:15 PM, Wes Turner wrote: > !cls #windows cmd's built-in cls command doesn't clear just the screen, like a VT100 \x1b[1J. It clears the console's entire scrollback buffer. Unix `clear` may also work like that. With GNOME Terminal in Linux, `clear`

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-17 Thread João Matos
Hello, I searched and found several possible solutions to clear the screen in the CPython REPL, but all are, in my opinion, complex for a newbie. The existence of a clear command would be a simple and obvious, therefore accessible to newbies. Best regards, JM On 17-09-2016 14:34, eryk

Re: [Python-ideas] Suggestion: Clear screen command for the REPL

2016-09-17 Thread João Matos
Hello, I know about those IPython commands and I searched and found several possible solutions to clear the screen in the CPython REPL, but all are, in my opinion, complex for a newbie. The existence of a clear command would be simple and obvious, therefore accessible to newbies. Best