M
Michael Torrie
How did I ever miss this before? That is truly awesome.
Changing the tab size from this default is what makes the code incompatible,
not the tabs themselves. So the solution is simple: do not change tab size
from the default.
People say I can use tabs all the way, just set them to the indent I want.
Well, I always had my indent independent of the tab size. Which is the way
it should be, after all, since one can indent with or without tabs, so
indent should not be tied to them.
But now I can not; python no longer lets me do that.
The new rules may look flexible at first sight, but the net effect they have
is they push me to use non-default tab size (which is not good),
I guess a discussion like this thread is the price to be paid for
relying solely on white space to delimit code blocks, like the python
syntax does.
What makes that not good? There is no law anywhere that says tabs are
8 characters. That's just an arbitrary amount that looked appropriate
to the people designing the first teletypes.
8-character tab stops should be the default. Debating that is I believe another topic, and compatibility with python2
should be enough to make that debate unnecessary.
Thank you,
Ahh but assuming tabs are the equivalent of 8 spaces can save 7 bytes
per tab character in the source code! Think of the savings.
8-character tab stops should be the default. Debating that is I believe
another topic, and compatibility with python2 should be enough to make
that debate unnecessary.
You are right, to change the tab size means to change the meaning of the
code, and that would be wrong. Can't argue with that.
What I want is an option to use the tabs as I have used them in the
past, with the default size.
Since "ambiguity" about the tab size
appears to be the cause for new python 3 rules, I though of an option
the make that size explicit. I still think users should somehow have a
way to use a tab stop of their choice, but how this could be achieved
properly is another problem.
I guess a discussion like this thread is the price to be paid for
relying solely on white space to delimit code blocks, like the python
syntax does.
So in other words, everybody must be forced to use 8-character tabs
because you want to be able to mix tabs and spaces.
Honestly, I really don't understand why you *want* to do that. If
your indentation is 4 characters, then that would be the natural tab
width to use. If you're not going to tie your indent to your tabs,
then why even use tabs in the first place?
What makes that not good? There is no law anywhere that says tabs are
8 characters. That's just an arbitrary amount that looked appropriate
to the people designing the first teletypes.
As for your problems, perhaps instead of coming on the list with a
poorly-thought-out subject line, and desire to simply argue, perhaps you
could run your code through a reformatter [...]
[...]
So in other words, everybody must be forced to use 8-character tabs
because you want to be able to mix tabs and spaces.
People say I can use tabs all the way, just set them to the indent Iwant.
Well, I always had my indent independent of the tab size. Which is the
way
it should be, after all, since one can indent with or without tabs, so
indent should not be tied to them.
But now I can not; python no longer lets me do that.
Honestly, I really don't understand why you *want* to do that. If
your indentation is 4 characters, then that would be the natural tab
width to use. If you're not going to tie your indent to your tabs,
then why even use tabs in the first place?
The new rules may look flexible at first sight, but the net effect theyhave
is they push me to use non-default tab size (which is not good),
What makes that not good? There is no law anywhere that says tabs are
8 characters. That's just an arbitrary amount that looked appropriate
to the people designing the first teletypes.
I am aware that 7 bytes per tab character (or 14/28, in UTF-16, UTF-32!)
will not justify the time spent debating.
The reason I want to use tabs is that I think there is nothing wrong with
them.
The reason why everybody should use 8-character tabs is so that I and the
rest of the world can use `grep` / `findstr` on their code, and still see
lines of code properly aligned in the terminal. Or to be able to print
fragments of code as plain text only, and get the proper alignment.
But most importantly, the reason that tab size should be 8 is so that all
of us people in this world can freely exchange formatted text like source
code without having to first consider if "will it look the same in their
editor ? What tab size do they use ?"
[...][...]The "def" line has four spaces. The "for" line then has a hard tab.
This is ambiguous. If the hard tab is assumed to have a width of four
spaces, then they are at the same indentation level. If it is assumed
to have a width of eight spaces, then they are not.
The correct tab stop positions have always been at 8 character columns apart.
The "ambiguity" was introduced by editors that do not follow the default value
set in hardware like printers or used by consoles and terminal emulators.
And now python forces me out of using any tab characters at all. I believe I
should still have a choice, python should at lest give an option to set tab
size, if the default of 8 is ambiguous now.
8 characters is common, but no more "correct" than any other,
Historically, software and hardware which assigns a meaning to a tab
character has come in two flavours:
1. Tab stops are every 8 columns; this cannot be changed.
2. Tab stops are configurable, defaulting to every 8 columns.
Yours frustratedly,
Joshua Landau
If your code depends on tab size then it's categorically wrong. Other
people's tab sizes are as valid. I use tabs because of the variation it
lets me have - I can switch tab sizes on the fly - and it's faster on
"dumb" editors. So let me do that.
But let us assume we were going to standardise on TAB == 8 SPACES. It
would *still* be bad to mix tabs and spaces. Hence you'd change Python
in exactly 0 ways. So *what do you want from us*?
3. Tab stops are measured in something other than characters.
With variable-width fonts, it's illogical to set tab stops in
characters. DeScribe Word Processor defined them in centimeters, way
back in the early... well, I didn't meet it till the 90s, but I don't
know how long it had been around before that.
Chris Angelico said:3. Tab stops are measured in something other than characters.
With variable-width fonts, it's illogical to set tab stops in
characters. DeScribe Word Processor defined them in centimeters, way
back in the early... well, I didn't meet it till the 90s, but I don't
know how long it had been around before that.
(*) There was a fad about 10 or 15 years ago to print code
samples in books in proportional fonts. Prentice-Hall seemed
to be particularly guilty of this. Fortunately, common sense
prevailed and everybody has gone back to monotype.
When the default tab size is 8, than tab size does matter.
What makes sense for a word processor and what makes sense for a
programming language are two very different things.
Word processors are almost always working with blocks of running text,
set in proportional fonts, often with multiple font sizes and styles.
It is usually assumed that line breaks are ephemeral, i.e. as the text
gets edited and reformatted, lines will re-flow.
Program text is almost always(*) displayed in a fixed-width font. ?No
font information is carried along with the program text at all; it is
assumed the reader will pick a font and size of their own preference,
with the only requirement being that it's monospaced.
(*) There was a fad about 10 or 15 years ago to print code samples in
books in proportional fonts. ?Prentice-Hall seemed to be particularly
guilty of this. ?Fortunately, common sense prevailed and everybody has
gone back to monotype.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.