Python's biggest compromises

John Roth newsgroups at jhrothjr.com
Sat Aug 2 16:39:09 EDT 2003


"Andy C" <ayc8NOSPAM at cornell.edu> wrote in message
news:y3VWa.261$_p6.23775419 at newssvr21.news.prodigy.com...
> > > it isn't to a compiler).  OTOH, *Python's* scheme is inferior to a
> > > pure-space-character indentation scheme because off the tab-vs.-space
> > > issue :-(
> >
> > Well, that's been recognized as a problem for a long time. I believe
> > that the intention is to mandate spaces only in Python 3.0. On the
> > other hand, I'm not holding my breath waiting for Guido to decide
>
> What's bad about tabs?  I'm new to Python.  Tabs are good because then you
> can view the source however you want.  I can't write in 4 space tabs and
> someone else can change it to 2 if they prefer.  But I can see the problem
> with continuation lines.  Also it must be ALL tabs or ALL spaces.  This
> shouldn't be too hard -- most editors have the "tabify" option.

The basic problem with tabs is that many tools don't handle them "right."
Especially when there's no agreement about what "right" means.
Originally, they were metal shims that were put onto the back of
typewriter carriages to stop the carriage at a particular point, and that's
the "official" meaning of tab to this day: it advances to the next multiple
of 8. According to this interpretation (which is *the* official
interpretation)
it's impossible to have only tabs and have any other indentation than 8
characters.

Many tools don't allow you to configure tabs, and of those that do,
each uses its own incompatible syntax and has its own quirks. In other
words, tabs may seem like a good thing if you use just one or two tools
that do what you want, but as soon as your program moves out into
the wild world, things change.

The only reason that Python works as well as it does with tabs is
that there is an undocumented hack buried in the guts somewhere
that identifies the comment line that emacs sticks into the program to
remember your settings. It does this for a couple of other popular
editors as well.

John Roth
>
> Andy
>
>






More information about the Python-list mailing list