I'm going to end this controversy once and for all. Is the syntactic whitespace of Python a good thing or a bad thing? It's neither; the best syntax is actually found in some relatively obscure languages.
First of all, I've used Python since about 1999/2000. It is the first language that really got me hooked into programming. It is the modern equivalent of Basic in that I would recommend it as anyone's first programming language. Yet it is a real, powerful language I still choose by default, and the professionals also use it extensively in places like Google. It is the closest thing to pseudocode I have ever seen — it is the only language where I can write down a substantial idea and it runs perfectly straight away.
Syntax aside, I think Python's real power lies in its Batteries Included philosophy — a metric bazillion of libraries for different tasks is available by default. When you're advanced enough a programmer to not care about superficial syntactic issues too much, you'll probably appreciate this. At the same time, Python is probably not the perfect language for your specific task, but its universality goes a long way.
For a long time, Fortran 90 was the language with the most plain and simple syntax I knew. It was also the best/fastest language I knew for doing math, which is what computers generally do; the scientifically minded syntax allowed smart compilers to parallelize even my most embarrassing code, years before the hoi polloi were sold SMP under the "dual core" slogan. It was my other favourite language besides Python.
Unfortunately, Fortran is not a very nice all-round language. However, Julia has managed to combine the best of Fortran and Python into a rather decent whole. The syntax is apparently inherited from Fortran, but there is a sense of Python underneath. To see for yourself, here is the main loop from my DNaLS code in Python...
...and in Julia:for x in range(xmin, xmax): if x % report_int == 0: workstate = text_encode([x, xmax, nmin, nmax, checksum]) print(workstate) qrks = qrklist(x) if len(qrks) > 0: for n in nlist: # Solutions are now handled within root_find_diff cs = root_find_diff(x, n, qrks) checksum = (checksum + cs) % checksum_mod
In many cases, porting Python to Julia simply involves removing the colon and adding the end statement. This marks the crucial difference in whitespace handling: Fortran/Julia only cares about line breaks. The "end" is superfluous with the human-readable indentation, but personally, I find it helps to have a clear marker; closing the mental parentheses. Besides, Python has an ugly punctuation character where Fortran/Julia has nothing.for x = xmin:(xmax - 1) if x % report_int == 0 # Fix the potentially negative modular checksum checksum += checksum_mod workstate = text_encode([x, xmax, nmin, nmax, checksum]) print(workstate, "\n") end qrks = qrklist(x) if size(qrks) > 0 for n in nlist # Solutions are now handled within root_find_diff cs = root_find_diff(x, n, qrks) checksum = (checksum + cs) % checksum_mod end end end
Now, Julia isn't the perfect all-round language either. For example, the quirks of different numerical types has driven me nuts from the beginning, but (a) it is probably expected from a numerically oriented language and (b) it is still being heavily developed. The JIT compilation issues are likewise of category (b).
I consider punctuation ugly when it makes things visually messy without providing any essential function. Of course, languages with C-style punctuation do have their reasons, which is basically the ability to put multiple statements on a single line. It is interesting to think why we would want that, given that an overwhelming majority writes with neat line breaks and indentation.
Incidentally, we have punctuation in natural languages for pretty much the same reason. Without punctuation,
we could simply write one clause per line and then we would not even need capitals to begin sentences but the downside would be that it would take a lot more paper to print books and it might also break the flow of reading
Source code is quite different from books. It actually benefits from having plenty of space and line breaks in the right places, because we don't read it like we read a book. In my experience, things often get ugly and inefficient if we insist on real-world or dead-tree models for our computing.