I hate you all

Chris Angelico rosuav at gmail.com
Fri Apr 5 20:35:04 EDT 2013


On Sat, Apr 6, 2013 at 11:22 AM,  <terminatorul at gmail.com> wrote:
> On Saturday, April 6, 2013 1:42:15 AM UTC+3, Ian wrote:
> [...]
>> The "def" line has four spaces.  The "for" line then has a hard tab.
>> This is ambiguous.  If the hard tab is assumed to have a width of four
>> spaces, then they are at the same indentation level.  If it is assumed
>> to have a width of eight spaces, then they are not.
> [...]
>
> The correct tab stop positions have always been at 8 character columns apart.
> The "ambiguity" was introduced by editors that do not follow the default value set in hardware like printers or used by consoles and terminal emulators.
>
> And now python forces me out of using any tab characters at all. I believe I should still have a choice, python should at lest give an option to set tab size, if the default of 8 is ambiguous now.

If you're indenting four spaces per level, then indent four spaces per
level. The code you posted would work perfectly if the indentation is
four spaces, then eight spaces, then twelve spaces. The problem is
that you have a stupid editor that's enforcing tabs instead of certain
multiples of spaces - get one that'll keep them all as spaces and you
won't have a problem.

Or use actual tabs, and set the displayed tab width to whatever you
feel like. That works, too. Neither option causes any problems with
any sane tools.

ChrisA



More information about the Python-list mailing list