Non-Indented python

Terry Reedy tjreedy at home.com
Tue Nov 27 15:30:18 CET 2001


"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
news:slrna071tg.isc.qrczak at qrnik.zagroda...
> Tue, 27 Nov 2001 01:27:15 +0000 (UTC), Huaiyu Zhu
<huaiyu at laplace.almaden.ibm.com> pisze:
>
> > - That there is no reason to associate tab with any equivalent in
spaces.
> >   It should only be used as a distinct character in its own right.
>
> What should a Python interpreter do with this?
>
> <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.

Each indent is effectively a temporary directive

#pragma <indent> = <tab> # or some number of spaces.

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

...
> Mixing tabs and spaces is not recommended because some people use
tabs
> in a wrong way (with a size different than 8), but I would not
forbid it.

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, which seldom gives one the visual layout one wants and
which is therefore arguably 'wrong'.

Terry J. Reedy





More information about the Python-list mailing list