Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pythonic Whitespace

Name: Anonymous 2011-11-05 21:16

Why does /prog/ dislike Python's use of whitespace? I have never had any problems with Python concerning whitespace, but numerous with C/C++.

Problems with C-style whitespace/bracing:
1) Code can be misleading, because while one reads indentation, it's not significant to the grammar. For instance:

if(true)
    a();
    b(); // This isn't actually in the body of the if.

2) There are over 9000 different ways of aligning bracing. Somehow, the most popular involves wasting a whole line for the opening brace'{'. Interestingly, such code always seems to neglect blank lines everywhere, leading to abominations like:

int a, b;
char c;
if(true)
{
    // do something
}

Why is the line of the if grouped together with the declarations of the variables!? What is wrong with the more readable and structured?:

int a, b;
char c;

if(true) {
    // do something
}

One can't say it's because the blank is a waste, because they often use nearly blank lines with solely '{' all the time!

Of course, Python saves even another line by eliminating the need for a closing brace '{'.

tldr: Why is Python's use of whitespace bad?

Name: Anonymous 2011-11-07 11:12

>>21
It only makes code more regular if they're required when there are arguments.
... and when you don't need to nest method calls. No, I, for one, agree the benefits probably outweigh the slight increase in complexity, but I can understand why Guido feels otherwise.

Also, by mentioning Scala in this context you just betrayed the fact that you are not actually a programmer, you don't write code (at least not in Scala) but learn trivia about languages for your ``nerd cred''. "Scala doing it right", my arse.

parentheses to call methods but not to access attributes is terrible. Ofc you can fix it with properties
You don't make sense.

>>22
I guess they run Python parser on preformatted blocks and apply syntax highlighting only to those which parse without errors. So that they don't get random highlights everywhere. Or maybe Guido deeply cares about justifying the decision to use colons, so he concocted this cunning deception, I don't know, that's possible too!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List