[Python-ideas] Pipe indentation

Stephen J. Turnbull stephen at xemacs.org
Tue Dec 10 08:02:47 CET 2013


Chris Angelico writes:
 > On Tue, Dec 10, 2013 at 4:21 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
 > > Christopher Welborn writes:
 > >
 > >  > Here's a link to a screen shot that shows Sublime Text's nesting level
 > >  > lines:
 > >
 > >  > http://imgur.com/yRGNCKu
 > >
 > >  > ...a lot of editors do this, tab or space.
 > >
 > > But do they get it Pythonically correct?  Ie, in counting indentation,
 > > 1 TAB = 1 SPC, regardless of what it looks like on screen.

Oops, that's TAB = SPC*8 in Python 2.

 > SciTE gets it Python3ically correct: tab != space regardless of
 > number.

But what does that mean?  How does SciTE distinguish between "SPC TAB"
at the beginning of line and just "TAB"?  Where does it place guidelines
given

def f(x):
SPC if x:
SPC SPC print("gotcha")
SPC else:
SPC TAB print("gotcha again")

which is acceptable to Python 3.3?  I suppose the right answer, as
usual, is "don't use both spaces and tabs for indentation in the same
program", but I guess then it really doesn't matter how the editor
handles tabs and spaces.

Oh, BTW, I'm definitely -1 on "pipe indentation" in the source
program, since editors can clearly do it if you want it (I don't)
whether it's present in the source, or not.







More information about the Python-ideas mailing list