indentation

Jorgen Grahn grahn+nntp at snipabacken.se
Sun Oct 19 14:05:08 EDT 2008


On 19 Oct 2008 14:34:45 GMT, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
> On Sun, 19 Oct 2008 07:16:44 -0700, Gandalf wrote:
>
>> every time I switch editor all the script  indentation get mixed up, and
>> python start giving me indentation weird errors. indentation also  hard
>> to follow because it invisible  unlike brackets { }
...
>> is there any solution to this problems?
>
> Discipline. Choose a standard indent and stick to it.

Doesn't pretty much everyone use spaces and a four-position indent? I
don't think I've ever come across any half-decent Python code which
didn't follow that convention.

...
> Especially never mix tabs and spaces in the same file.

Actually, the only really likely reason he sees "mixed up" indentation
is that he has mixed TAB/space source code *and* a misconfigured[0]
editor which sets the TAB stops at anything else than every 8th
character.

If I was him, I'd check and fix my editors first, and/or tell my
coworkers to stop emitting broken[0] TABs.

/Jorgen

[0] This is an old and tedious topic ... my view on TABs is that they
    are useless iff they aren't rendered the same way everywhere. The
    size 8 is hard-coded into terminals, printers and programs since
    ancient times; thus anything else is wrong.

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.se>          R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list