Larry Wall's comment on python...

Alex Martelli aleax at
Mon Sep 23 03:08:53 EDT 2002

Greg Ewing wrote:

> Courageous wrote:
>> One should use spaces
>> and not tabs in Python code. Otherwise, any python file where
>> tabs and spaces are mixed is also a choice of which indentation
>> level other viewers of the code MUST use in their editors.
> If you use spaces only, you're also choosing how other
> people will see it in their editors (unless they're
> willing to use a tool to re-indent it).
> Using *tabs* only is the only way to get truly
> preference-independent indentation.

...unless other people use tools that do NOT let them change the
ways tabs are displayed, and that way is intolerably incompatible
with your use of tabs.

Both Outlook Express and KDE's KNode (in KDE 2.2 at least --
that's what I'm using today) are good examples of such tools
that are in everyday use by many people.  The amount of space
displayed for a leading tab is ZERO.  Just imagine how neat
this makes reading Python code posted to this newsgroup, when
the poster uses tabs there (for example because they use tabs
normally in their on-disk sources, and copy and paste is the
best way to post some snippet).

That's just one example (well, two, since KNode and OE are
completely separate programs) -- anybody who prints your
source code is similarly at the mercy of their printer's
drivers (many of which don't allow tabs to be changed), etc.

Unless you KNOW all the tools that will ever be used to look
at your source code -- which basically means, you will never
distribute your source code outside of a small group under
your strict control, never post any snippet thereof to
to ask a question nor to aswer it, etc -- I consider using
tabs to be anti-social and a massive annoyance.  Follow the
style guide and use 4 spaces per indentation level, if you
like to think of yourself as a 'good citizen', rather than a
missionary who wants to force everybody to read news with
Emacs (or whatever other highly-flexible tool of choice).


More information about the Python-list mailing list