[Tutor] IDLE shell indentation?

eryksun eryksun at gmail.com
Fri Oct 19 07:51:42 CEST 2012


On Thu, Oct 18, 2012 at 11:23 PM, boB Stepp <robertvstepp at gmail.com> wrote:
>
> This does keep the alignment I desire; however, IDLE shell's
> autoindent feature goes away inside the exec function. Further, my
> tab, which is set to 4 spaces, becomes 8 spaces at the indent;
> apparently the tab takes effect after where ">>> " would normally
> occur. Of course I can just manually type the four spaces. Alas!
> Perfection here is apparently unattainable! ~(:>))

The shell in IDLE doesn't replace tabs with spaces for me. I hadn't
considered the loss of auto-indenting. I don't use IDLE, and only use
exec() like I showed when pasting an arbitrary selection of code into
a terminal.

IPython's Qt console does auto-indenting and replaces tabs with 4 spaces:

    In [1]: zero, phrase = '', 'spam'

    In [2]: if zero:
       ...:     print(zero)
       ...: else:
       ...:     print(phrase)
       ...:
    spam

http://ipython.org/ipython-doc/dev/interactive/qtconsole.html

Also, IEP is a nice little IDE that I used to use. I think it's a vast
improvement over IDLE. It works simultaneously with different
interpreters (2.x, 3.x, pypy) and GUI toolkits.

http://code.google.com/p/iep


More information about the Tutor mailing list