[Tutor] IDLE shell indentation?
boB Stepp
robertvstepp at gmail.com
Fri Oct 19 05:23:41 CEST 2012
On Thu, Oct 18, 2012 at 9:46 PM, eryksun <eryksun at gmail.com> wrote:
<snip>
> You're right that the alignment changed because of the font rendering
> of the tab character. In Firefox I use the following to get a
> monospace font in Gmail:
>
> http://userstyles.org/styles/15618/gmail-monospace-font-for-body-messages-textarea
It did not occur to me to search outside of the gmail/chrome help as I
felt sure that monospace capability had to be built-in! Thanks for
pointing me elsewhere. Now all is swell.
> As to your main question, I use exec:
>
> >>> zero, phrase = '', 'spam'
> >>> exec('''
> if zero:
> print(zero)
> else:
> print(phrase)
> ''')
> spam
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! ~(:>))
boB
More information about the Tutor
mailing list