Indentation style...

Alex Martelli aleaxit at yahoo.com
Mon May 28 16:02:00 EDT 2001


"Emile van Sebille" <emile at fenx.com> wrote in message
news:9etto3$15aqa$1 at ID-11957.news.dfncis.de...
> From the Python Language Reference:
> """2.1.7 Indentation
    ...
> First, tabs are replaced (from left to right) by one to eight spaces such
> that the total number of characters up to and including the replacement is
a
> multiple of eight (this is intended to be the same rule as used by Unix).
    ...
> > # tab-width:4
> >
> > def f():
> >     a = 1      # four spaces indent
> > b = 2  # one tab indent
> >
> > The Python tokenizer recognizes various forms of the tab-width comment.
> > I'm not sure it's documented anywhere except in the sources.

I think 2.1.7 is lying -- the tokenizer DOES look for various kind
of Emacs, vi and vim tab-setting indications, and those, if found,
override the normal setting of tab width as 8.  If 2.1.7 was right,
the example function would break... and yet it does work.


Alex






More information about the Python-list mailing list