On Wednesday, 30 April 2014 at 08:52:48 UTC, Chris wrote:
Say you have a Python file with 500 lines of code. Try to copy and paste something with a different indentation from somewhere else into an if statement.

Paste in non-formatting-mode and use the editor's ability to block indent? Having an editor that will indent/unindent regions when you hit tab/shift-tab helps.

This kind of patronizing bullshit was invented for non-programmers who might make a mess of the code otherwise.

It is true that Python grew out of a programming language tradition meant for teaching/prototyping.

But the Python syntax it is more useful for an interpreter prompt (REPL) than a syntax with explicit begin/end markers. Most of the non-trivial transformations I do start at the REPL before being pasted into the editor.

In D you can do this:

if (mode == "TEST") {  // Second block added later
if (x == 1) {  // First block
 writeln("Hurray!");
}
}

I think Go did the right thing by not requiring the redundant parantheses on the if statement and perhaps also by allowing the omission of semicolons where appropriate etc. Room for improved legibility right there.

In Python I would probably use «TEST» rather than «mode=="test"»:

if TEST&& x == 1:
    …

Ola.

Reply via email to