How to set the history commands visible ?

Laura Creighton lac at openend.se
Mon Sep 14 10:01:22 CEST 2015


In a message of Sun, 13 Sep 2015 23:35:01 +0200, Glus Xof writes:
>If I'm not wrong, in a later interpreter versions, when an enter key was
>pressed after writing something requiring some indentated statement(s)...
>like in:
>
>>>> for i in range (0,3):
>
>the system used to suggest "one tab" placing the cursor automatically after.
>
>I don't know why this feature doesn't remain yet... or maybe I don't know
>how activate this...
>
>Glus

I think you must have had some sort of custom startup script here.
Maybe even this one:
https://github.com/brandoninvergo/python-startup/blob/master/python-startup.py

though I found it annoying as anything as it only does the tab indent
after you have started typing.

If you decide to hack on custom startup scripts you may be interested in
https://bitbucket.org/pypy/pyrepl

PyPy needed to make a pure python replacement for readline, and did so.
It has some nice support for multi-line editing and a lot of emacs
style keybindings.  I like it.

Also, if you paste output from the interpreter into mail to other
people, you should edit your python startup file to reset sys.PS1 to
not be '>>>' right at the margin.  (mine is ' >>>').  The arrogant
idiots at Google have decided that people who ask for plain text mail
(which you currently cannot do using gmail on android) in no way
should be trusted to know what they are doing.  Thus any text that
begins with some number of '>' can be reflowed, at will, by gmail.

Since you are a gmail user, you should be able to see this:

>>> import sys
>>> import os
>>> import tkinter
>>> from __future__ import print_function
>>> for i in range(3):
...     print (i)
...
0
1
2

Now try to reply to me, quoting this in gmail.  Gmail will happily reflow
the lines above.


But it will respect these ones.

 >>> import sys
 >>> import os
 >>> import tkinter
 >>> from __future__ import print_function
 >>> for i in range(3):
...     print (i)
...
0
1
2

sys.PS1 is what is giving me ' >>>' and sys.PS2 is ...

If you want sys.PS2 to be a tab, then you can do this as well, but
note that it does not stick a tab into your input buffer for you,
so you will still need to type one -- or whatever number of spaces
you use as an indent.

If I have misunderstood, and your problem is that your editor
no longer suggests tabs, then you have lost your python-mode
settings for that editor.  But we need to know what editor that
is, before we can tell you how to fix it.

Laura


More information about the Python-list mailing list