Tabs and spaces (style)

Alex Martelli aleaxit at yahoo.com
Wed May 2 07:31:59 EDT 2001


"Cantanker" <az at cantanker.net.nospam> wrote in message
news:EpKH6.3785$VM5.125451 at ozemail.com.au...
> Kenneth Loafman <ken at lt.com> wrote:
>
> > I'm just the opposite... why would anyone use tabs?  All a tab does is
> > screw up the alignment for anyone that has a different tab size set and
> > makes it very difficult to print, etc.
>
> How so? If everyone uses tabs exclusively, it wouldn't matter whether I
> set my editor to display (or print filter to print) tab characters at
> 2,4,8 or 16 spaces, because anyone else can edit my file and have his or
> her editor set to any other possible tab size, and _ALL_ the code will

Where does the assumption come from, that an editor is the ONLY kind
of tool that will ever need to be run on a source-code file?

> Of course, when writing text which is to be _viewed_ (email, news,
> READMEs), I always use ':set et' which expands tabs to spaces, but for

You do.  Many others don't -- comp.lang.python is FULL of source
code examples and snippets posted WITH tabs.

> text to be _edited_ by others you would use tabs, for the reasons above.

An _editor_ program in particular should have no problem interpreting
leading whitespace, however it's coded as long as it's consistent (i.e.
it would run with -tt), should it?  Keep it on file in any format
whatever, have it tabs-only when in memory, put it back to spaces-only
when saving it _so that *other* less-clever tools don't trip you up_...


Alex






More information about the Python-list mailing list