Re: Tab indentions on different platforms?
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- Date: Sun, 30 Dec 2007 20:41:09 -0000
* Ben Finney (Sun, 30 Dec 2007 15:36:12 +1100)
Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
On Sat, 29 Dec 2007 15:29:25 +0000, Thorsten Kampe wrote:
I'd personally go for spaces because:
1. I don't like things I cannot see (control characters)
You can see spaces but not tabs? Your editor is pretty weird. In all
the editors I've every used, both spaces and tabs show up as empty
white space. (Or coloured space if I set the editor to use a
coloured background.)
Though Thorsten could have been clearer, "thing that is not a space
character but shows up as white space" is a near-enough approximation
of "thing I cannot see".
2. I never had problems with spaces but plenty with tabs
Periodically, I ask on this list what problems people have with
tabs. (I'm fully aware that mixing tabs and spaces is a Bad Thing.)
I've had little luck getting any answer except "Tabs are bad,
m'kay?".
Posit: White space is most often achieved by the user inserting a
sequence of space characters (U+0020).
Posit: Tab characters (U+0009) are, in a majority of environments,
rendered visually indistinguishable from a sequence of space
characters.
Corollary: most readers will, when seeing a stretch of white space on
a line, default to assuming that it represents a sequence of space
(U+0020) characters.
Corollary: So when a file containing either spaces or tabs is edited
in such an environment, the common way chosen by the user to get to
the same indentation level as existing lines is to prepend space
characters (using the spacebar or the Tab key or whatever facility the
editor provides) until the indentation lines up visually --
remembering the caveat that tabs and space-sequences are visually
indistinguishable in many environments.
Argument: The user will get an unexpected result when they do the
obvious thing (prepend space characters) in a tabs-only file. With
existing spaces-only files, the obvious way to get matching
indentation gives the expected result.
Conclusion: Thus, using tabs-only is inferior to using spaces-only for
indentation, because it violates the Principle of Least Astonishment
<URL:http://en.wikipedia.org/wiki/Principle_of_least_astonishment>.
Man, how did you know what I wanted to say (but failed to to express)
:-) ? Anyway: the consequence of your well done argumentation is that
someone editing Python code has to use a specialised editor to prevent
screwing up tab indented code - and that's bad.
Thorsten
.
- Follow-Ups:
- Re: Tab indentions on different platforms?
- From: Steven D'Aprano
- Re: Tab indentions on different platforms?
- References:
- Tab indentions on different platforms?
- From: xkenneth
- Re: Tab indentions on different platforms?
- From: Thorsten Kampe
- Re: Tab indentions on different platforms?
- From: Steven D'Aprano
- Re: Tab indentions on different platforms?
- From: Ben Finney
- Tab indentions on different platforms?
- Prev by Date: Re: Tab indentions on different platforms?
- Next by Date: Re: Bizarre behavior with mutable default arguments
- Previous by thread: Re: Tab indentions on different platforms?
- Next by thread: Re: Tab indentions on different platforms?
- Index(es):
Relevant Pages
|