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.

Stephan


2016-09-29 9:12 GMT+02:00 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, Stephan Houben
> escreveu:
>
>> 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
>> the prompt.
>>
>> Stephan
>>
>> 2016-09-29 8:50 GMT+02:00 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 -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 standard way to
 interrupt the interpreter regardless of whether you are using Linux,
 Mac
 or Windows.

 (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?)


 --
 Steve
 ___
 Python-ideas mailing list
 python...@python.org
 https://mail.python.org/mailman/listinfo/python-ideas
 Code of Conduct: http://python.org/psf/codeofconduct/

>>>
>>> ___
>>> Python-ideas mailing list
>>> python...@python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>>
>>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

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, Stephan Houben 
escreveu:

> 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 
> the prompt.
>
> Stephan
>
> 2016-09-29 8:50 GMT+02:00 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 -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 standard way to 
>>> interrupt the interpreter regardless of whether you are using Linux, Mac 
>>> or Windows. 
>>>
>>> (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?) 
>>>
>>>
>>> -- 
>>> Steve 
>>> ___ 
>>> Python-ideas mailing list 
>>> python...@python.org 
>>> https://mail.python.org/mailman/listinfo/python-ideas 
>>> Code of Conduct: http://python.org/psf/codeofconduct/ 
>>>
>>
>> ___
>> Python-ideas mailing list
>> python...@python.org 
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

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 move the
> prompt to the top, so you end up with a bunch of empty lines, followed by
> the prompt.

You probably have pyreadline installed. It calls ReadConsoleInputW to
read low-level input records, bypassing the console's normal cooked
read. See the following file that defines the key binding:

https://github.com/pyreadline/pyreadline/blob/1.7/pyreadline/configuration/pyreadlineconfig.ini#L18

Unfortunately pyreadline is broken for non-ASCII input. It ignores the
Alt+Numpad record sequences used for non-ASCII characters.

Without having to implement readline module for Windows (personally, I
don't use it), support for Ctrl+L can be added relatively easily in
3.6+. ReadConsoleW takes a parameter to specify a mask of ASCII
control characters that terminate a read. The control character is
left in the buffer, so code just has to be written that looks for
various control characters to implement features such as a Ctrl+L
clear screen.
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 the
> prompt to the top, so you end up with a bunch of empty lines, followed by
> the prompt.

Do you have pyreadline installed? I believe that intercepts things like CTRL-L.

Paul
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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
the prompt.

Stephan

2016-09-29 8:50 GMT+02:00 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 -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 standard way to
>> interrupt the interpreter regardless of whether you are using Linux, Mac
>> or Windows.
>>
>> (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?)
>>
>>
>> --
>> Steve
>> ___
>> Python-ideas mailing list
>> python...@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

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 -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 standard way to 
> interrupt the interpreter regardless of whether you are using Linux, Mac 
> or Windows. 
>
> (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?) 
>
>
> -- 
> Steve 
> ___ 
> Python-ideas mailing list 
> python...@python.org  
> https://mail.python.org/mailman/listinfo/python-ideas 
> Code of Conduct: http://python.org/psf/codeofconduct/ 
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/