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-06 22:50

I dislike additional rules that will cause my program to not work unnecessarily. I'm completely unfamiliar with Python, but the idea of rules for how you can use white space sounds irritating to me, the same as semicolons tend to annoy anyone new to C. Sure it's petty and stupid, but having your program crash because you forgot something simple like a space is discouraging.

I'm guessing anyone complaining about whitespace in Python is new to it and not used to it. It's probably best to ignore them.

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