how to reduce bugs due to incorrect indentation

Larry Martell larry.martell at gmail.com
Thu Feb 6 17:09:43 EST 2014


On Thu, Feb 6, 2014 at 4:32 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 02/06/2014 12:36 PM, Larry Martell wrote:
>>
>> On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote:
>>>
>>> msustik at gmail.com schreef:
>>>>
>>>>
>>>> While editing this file I accidentally pushed TAB on the line with 'y =
>>>> z
>>>> + y'.
>>>
>>>
>>> My suggestion: configure your editor to insert the appropriate amount of
>>> spaces instead of a tab when you press the tab key.
>>
>>
>> +1 - tabs are evil.
>
>
> Tabs are not evil, and an argument can be made that tabs are better (a
> decent editor can be configured to show x many spaces per tab, then users
> could decide how much indentation they preferred to see... but I digress).
>
> Using spaces instead of tabs would also have not prevented the error that
> Msustik encountered, and for that matter we don't know whether he was using
> tabs or spaces in his source file, only that he hit the Tab key -- surely
> you are not suggesting everyone rip out their tab key and just hit the space
> bar four times for each level of indentation?  ;)

The Tab key is not evil, it's the tab character (Ctrl-I). I have been
bitten by this many time when I had to work on a program written by
another. They had their tab stops set at 5 or 6, mine is set at 4, or
they did not have expandtab set, but I did. So you get either a script
that looks misaligned, but works, or one that does not look misaligned
but doesn't work. When I have to pick up someone else's script the
first thing I do is replace the tabs with spaces.



More information about the Python-list mailing list