General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lawrence D’Oliveiro
Computerphile
comments
Comments by "Lawrence D’Oliveiro" (@lawrencedoliveiro9104) on "Tabs or Spaces? (Soundcheck Question) - Computerphile" video.
@IceMetalPunk Code can only do what it does. Comments that describe what the code does are obviously superfluous, but ones that explain why it is doing what it is doing should be essential. How could code ever be “self-explanatory” in that way? It cannot.
23
@Mtaalas Luckily, Python’s use of whitespace is pretty much consistent with my formatting conventions anyway. I do still put in “#end” comment lines. If nothing else, it gives Emacs something to jump to, so I can quickly move between the beginning and ending of a block just by looking for lines with the same indentation level.
6
You mean you don’t post your .emacs on GitHub, where you can easily clone it onto any machine?
2
Neither: for (...) { ... } /*for*/ In C++ code, I have written things like for ( vector<DocTemplate::FieldDef>::const_iterator ThisField = Context.CertTemplate->Fields.begin(); ThisField != Context.CertTemplate->Fields.end(); ++ThisField ) { ... } /*for*/
1
I used to use the tab key, but only in editors where you could customize it to go in steps of four columns. This still caused problems looking at the text in other programs which did not have such an option. So I switched to spaces. Now I know my formatting will look the same regardless of what program is displaying it. For backward compatibility, I still have Emacs configured to sniff the file on opening; if it detects tabs, then the tab key generates tabs in that buffer, otherwise pressing tab inserts spaces.
1
Actually, Python won’t let that happen. It disallows inconsistent mixes of tabs and spaces.
1
@abram7547 Sure, I just tried it. A simple four-line script I called “space_test”: if True : print("hi!") print("hi!") #end if (That’s four spaces at the start of the first print, a tab at the start of the second one). Then when I tried running it: ldo@theon:~> python3 space_test File "space_test", line 3 print("hi!") ^ TabError: inconsistent use of tabs and spaces in indentation So you see, Python does prevent that sort of thing.
1
5:50 That’s a job for auto-indentation, which is quite a separate function: press Enter, and automatically have the same whitespace inserted at the start of the new line that is at the start of the previous line.
1
OK, here’s another one: how wide do you set your editor windows? I currently use about 100 columns, and sometimes I think I need more.
1
Apology accepted for thinking so.
1
export PAGER='less -iXx4'
1