|
No, it’s logical: four spaces would indent too much in relation to font size.
Full disclosure: I also use two spaces and a tiny font
Mircea
|
|
|
|
|
I have the opposite opinion, I think the indent should remain constant (maybe about a 1/4 or a 1/2 inch) regardless of font size, so a tab-stop would use fewer character-places with a larger font and more with a smaller one.
But I know of no IDE which uses absolute tab-stops -- I wouldn't willingly code in a word processor.
|
|
|
|
|
Let’s agree to disagree
There is a reason however why letters have a certain height to width ratio. Also paragraph indenting, in books that use it, is proportional to font size. Your artistic eye might know better than your logical brain
Mircea
|
|
|
|
|
Certainly, and a lot of this still stems from VT screens and such with only one or two character sizes.
On a VT340 or such I used the 132 character-per-line setting because I didn't like to 80 character-per-line limit.
I'm not real concerned with literature type setting.
Don't get me started on illuminated letters at the start of every block... 
|
|
|
|
|
Mircea Neacsu wrote: There is a reason however why letters have a certain height to width ratio. Also paragraph indenting, in books that use it, is proportional to font siz
True.
However English text is the not the same as programming. I read English very fast and often deliberating skip parts. Certainly I am generally oblivious to periods.
But ignoring a period in programming would be a bad idea.
In the editor I use the typeface is specifically not proportional. I have tried it and found it to be a very bad idea. In English text the layout of the text seldom has meaning. In programming the layout does convey information such as easily seeing blocks.
|
|
|
|
|
I didn’t say the text of a program is the same as the text of a novel. What I do say however is that people writing programs could use a bit from the centuries of experience of typographers.
It might be one of my (many) obsessions, but being somewhat dyslexic, I pay a lot of attention to things like font typeface, tab sizes page layout and such. When things go well, my programs are a thing of beauty in content and form. That happens rarely 🤪
Mircea
|
|
|
|
|
Mircea Neacsu wrote: I didn’t say the text of a program is the same as the text of a novel
The thread is about programming but you then said the following
"in books that use it, is proportional to font size"
The way I read that post suggested that there is an equivalence. As I read it. I saw nothing in the post to which you responded which would have suggested they were referring to English.
|
|
|
|
|
Tab spaces should be in half-inches or centimeters, depending where you live. Not characters.
Nothing succeeds like a budgie without teeth.
To err is human, to arr is pirate.
|
|
|
|
|
I agree, but only as an ideal as I know no IDE which can do that.
|
|
|
|
|
I do not understand why anyone uses spaces tbh. I also set my tab spacing to 2, but most of the legacy code I work on - and even some of the newer stuff added to that legacy code - uses spaces, and are thus untidy along the left margin and often not collapsible. Use tabs, for the love of pretty code, and for that matter, used blank lines between logical blocks. And concise comments.
|
|
|
|
|
I see no reason it wouldn't be collapsible. What IDE can't collapse it?
How does your code look if you open it in another IDE/editor? Open it in Notepad for instance.
|
|
|
|
|
a slight exaggeration and significant simplification:
some code
some more code that should be on the same tab as the above, but here's a loop
{
code that loops or whatever
// a comment
}
// a comment
code loop
{
code
}
|
|
|
|
|
PIEBALDconsult wrote: I think some TABophiles use TABs to save keystrokes.
I use spacing to provide formatting.
Tabs in a file, not spaces allows one to skip backwards with fewer keystrokes. Never seen that happen with pseudo spaces (tabbing but with space replacement.)
Since I am also very much a touch typist auto indenting tends to be a hinderance since it tends to break my train of thought. While tabbing (space replacement or not) is fewer keystrokes to get to where I actually want to be without it.
|
|
|
|
|
jschell wrote: skip backwards with fewer keystrokes
Yes, I can see that, but it isn't that big of a deal for me, in fact I think I frequently use the mouse to do that, which is worse.
Also, when using two SPACEs per indent it's less of a burden than with four.
jschell wrote: a touch typist
I definitely am not, but coding is like writing literature, so it's OK.
jschell wrote: auto indenting tends to be a hinderance
Unsure what you are referring to. If you mean having a new line auto-indented to the same level as the previous when you hit RETURN, I like that. With my coding format style, I have a lot of indent levels, so that saves me type.
jschell wrote: it tends to break my train of thought
There are still things Visual Studio does which I don't like and I seem to have no control over them, and I occasionally have to UNDO (Ctrl-Z) an auto-formatting change it made.
It's part of why I wrote my own simple IDE which does only what I want it to.
|
|
|
|
|
Just add braces. For the "purists" make them optional. I have set a new project NPP policy: No Python Period. Cannot find a compelling reason to introduce chaos just to be trendy.
|
|
|
|
|
Any programming language that depends on formatting is fundamentally flawed by design!
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
I use two SPACEs per TAB. The simple IDE I wrote can do it, even were I ever to use it for Python.
On the other hand, a TAB-stop should be a certain width (e.g. a half inch), regardless of font and display medium, not measured in "character positions". If we could have that, then maybe TABs would make sense.
|
|
|
|
|
Why don't Python editors indicate tabs/spaces with some sort of symbol? Perhaps '{' for tab and ' ' for space. To be even more helpful, the editor could indicate the end of a block with '}' ?
|
|
|
|
|
|
I refer to it as "invisible source code" because that's what significant whitespace is.
And it's just as stupid as it sounds. How do you debug that which you cannot see?
It's risible.
To err is human. Fortune favors the monsters.
|
|
|
|
|
With 8 Bit micros it made sense, when I jumped to 16 Bit (Amiga 500, Amiga Basic, AMOS, C & 68K assembly!) no spaces. Why with a new language?
|
|
|
|
|
Considering it was named after the people who gave us the Ministry of Silly Walks, Dead Parrots, and the Argument Sketch, what else would you expect?
honey the codewitch wrote: It's risible. Had to look that word up, which caused me to be risible.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
I’m begging you for the benefit of everyone, don’t be STUPID.
|
|
|
|
|
You are not the only one ... I must admit I looked it up, too , feel safer now
|
|
|
|
|
OK, "risible" ... thanks, never heard of it
|
|
|
|
|
You don't remember "Life of Brian" with the centurion who can't stop laughing at the name "Biggus Dickus".
"Do you find it wisible?"
|
|
|
|