Indentation style...

Alex Martelli aleaxit at yahoo.com
Mon May 28 04:55:44 EDT 2001


<bas.vangils at home.nl> wrote in message
news:4rmQ6.128663$y7.790854 at dbsch1.home.nl...
> Thomas Wouters <thomas at xs4all.net> wrote:
>  * No, no, no! Tabs are 8 spaces. Eight. Spaces. Always. Setting it to
anything
>  * else is Lunacy! Sure to screw you over, or at least *someone*, sooner
or
>  * later. If you want to re-indent, your editor can re-indent the code in
>  * whatever way you wish, though I would vote against it.
>
> I think we disagree. The trick with a tab is that you don't care / don't
know
> how "big" it is. Sure, most editors expand it to eight spaces (unless you
tell
> them otherwise). Personally I like tab's to be displayed as three spaces.
Now

...and the key problem is that most people use several tools to
handle source files, not just their favourite editor (EMACS fans
are laughing, of course, but...:-).  For example, some of the most
popular news/email clients on Windows platforms, such as Outlook and
Outlook Express, display tabs as ZERO spaces.  This makes Python
source cut-and-pasted to email just about unreadable to many of the
intended readers, if said source used tabs for indentation.  Some
printer drivers hardcode tabs to 8 spaces, other behave differently --
when you print some snippet of the sources, unless your editor or
other tools are ALWAYS used to filter tabs by transforming then into
spaces, you may be SOL.  Etc, etc.

Given the variety of tools that you *or somebody else who might
need to handle your sources* might be using, having *no* tabs at
all is best -- our BDFL was wise as usual in switching the officially
recommended style to "use spaces for indentation, not tabs".
Second-best is using tabs hard-coded at 8 spaces, as was the
previously official style -- most tools (NOT all -- see Outlook)
will support that to some extent.  Assuming that you _and every
other future user of your source_ can play "the tricks with a
tab" that you take for granted is unwarranted optimism:-).


Alex






More information about the Python-list mailing list