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 regards,

JM



On 17-09-2016 14:15, Wes Turner wrote:
With IPython, there are a number of ways to reset the terminal display:

  clear  # %clear
  !cls #windows
  !reset

- http://stackoverflow.com/questions/6892191/clearing-the-screen-in-ipython
  - Ctrl-L is a readline binding
- http://pythonhosted.org/pyreadline/usage.html#pyreadline-with-python-interpreter
  - https://anaconda.org/anaconda/pyreadline
  - https://pypi.python.org/pypi/pyreadline
- IPython >= 5 no longer uses pyreadline (instead, python prompt toolkit) - https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/shortcuts.py #def clear


- http://unix.stackexchange.com/questions/124762/how-does-clear-command-work - http://urwid.org/reference/display_modules.html#urwid.raw_display.Screen.clear
- https://rosettacode.org/wiki/Terminal_control/Clear_the_screen#Python

On Saturday, September 17, 2016, João Matos <jcrma...@gmail.com <mailto:jcrma...@gmail.com>> wrote:

    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 useful for newbies, which don't know
    anything about usercustomize or sitecustomize.


    Best regards,

    JM


    On 17-09-2016 12:07, Chris Angelico wrote:

        On Sat, Sep 17, 2016 at 8:51 PM, João Matos
        <jcrma...@gmail.com> wrote:

            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 learning
            Python from the REPL.
            After some trial and errors it is best to start with a
            clean screen.
            Clearing the screen helps clear your mind.

        I'm not sure that it _is_ helpful, given that you're starting
        with a
        clean screen but not restarting the session (so you'll still
        have all
        the state from your previous work). If you want a completely fresh
        start, just exit Python, clear the screen with a shell
        command, and
        re-enter.

        The easiest way to play around with this would be to create a pure
        Python clear() function in your usercustomize or
        sitecustomize, and
        then try it in your own workflow - see whether it annoys you
        that it
        doesn't change the interpreter state. Maybe it will, maybe it
        won't.

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


    _______________________________________________
    Python-ideas mailing list
    Python-ideas@python.org
    https://mail.python.org/mailman/listinfo/python-ideas
    <https://mail.python.org/mailman/listinfo/python-ideas>
    Code of Conduct: http://python.org/psf/codeofconduct/
    <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/

Reply via email to