Non-Indented python

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Nov 27 13:34:18 EST 2001


Tue, 27 Nov 2001 14:30:18 GMT, Terry Reedy <tjreedy at home.com> pisze:

>> <TAB>if 0:
>> <TAB><TAB>print "0"
>> <SPACE><SPACE><SPACE><SPACE><SPACE><SPACE><SPACE><SPACE>print "1"
> 
> Raise SyntaxError.
> 
> Seriously.
> 
> This would be consistent with general philosophy of not guessing in
> the face of ambiguity.

For me there is no ambiguity because tabs always have size 8.

> Once such a directive-by-first-use is made, it is not unreasonable
> to require consistency until cancelled by a corresponding dedent..

Let's suppose I'm editing a file written by somebody else. I want to
insert a statement so I hit Enter at the end of a line. The editor
automatically indents the new line. Later it causes SyntaxError
because the file happened to use tabs and I've set my editor to use
spaces for indentation.

Who is at fault? My poor editor which is unable to guess tab / space
convention used in the file and adapt to it automatically? The original
author who used tabs at all? Me because I didn't convert the file to
spaces before editing?

> As I explained in my last post in this thread,
> <tab> := <move to the next multiple-of-8 (+index base) column>
> is not 'right' but merely an ill-chosen convention of a minority of
> computer users,

It's not a minority. Almost everybody uses this convention. It's
better to use the most common convention consistently than to invent
new conventions (like "tab = one indent level").

We could live without tabs if ASCII was designed today, but they
are there.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK



More information about the Python-list mailing list