PEP8 and 4 spaces

Chris Angelico rosuav at gmail.com
Fri Jul 4 16:58:30 CEST 2014


On Sat, Jul 5, 2014 at 12:54 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Grant Edwards <invalid at invalid.invalid>:
>
>> Definitely. Indenting with tabs vs. spaces is mostly personal
>> preference (though spaces are better!). But, mixing the two is right
>> out, and should be stomped on hard.
>
> Often one person writes the code and another person fixes bugs in it or
> adds features to it. So if one uses tabs and the other refrains from
> using them, you'll get the mixed style you abhor.
>
> Even if we accepted that to be bad style, there's nothing on the screen
> that would warn against such usage: the lines seemingly align perfectly,
> and the code runs as expected.

That depends on your editor. SciTE, for instance, will give a warning
any time indentation changes wrongly; if you mix tabs and spaces,
there'll be error markers at the beginning of each change (so if
there's one line with eight spaces amid a sea of tabs, that line and
the one below it will be marked).

ChrisA



More information about the Python-list mailing list