Linked by Eugenia Loli on Sat 15th Jul 2006 22:45 UTC
.NET (dotGNU too) Jeff Cogswell writes: "I'm about to make a confession. Even though I've written several books and articles about C++, I have a secret: C++ isn't my favorite language. I have lots of languages that I use, each one for different purposes. But the language I consider my all-time favorite is Python."
Thread beginning with comment 143522
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Python is . . .
by CrLf on Sun 16th Jul 2006 13:14 UTC in reply to "Python is . . ."
CrLf
Member since:
2006-01-03

"Too bad the authors of Python hadn't had to write enough COBOL or Fortran to understand what a bad idea using indentation as a syntactic element is."

There are many objectionable things in Python, but the indentation seems to be criticized only by people that never used the language.

The indentation rules in Python are exactly those that any half decent programmer already follows in *every* language (and Python doesn't impose any specific indentation style, just *any* indentation style).

Reply Parent Score: 5

RE[3]: Python is . . .
by rayiner on Sun 16th Jul 2006 15:22 in reply to "RE[2]: Python is . . ."
rayiner Member since:
2005-07-06

I think the complaint is more about what happens in large-scale projects when people invariably mess up the indentation guidelines and keep the script from running. I munged up some C code pretty bad the other day, because our policy is to use tabs to indent, but I was working on some code that had 3-space indents (btw --- what kind of uncivilized jackass uses 3-space indentation?).

Reply Parent Score: 3

RE[3]: Python is . . .
by Cloudy on Sun 16th Jul 2006 18:11 in reply to "RE[2]: Python is . . ."
Cloudy Member since:
2006-02-15

The indentation rules in Python are exactly those that any half decent programmer already follows in *every* language (and Python doesn't impose any specific indentation style, just *any* indentation style).

The rule that statements are terminated by line endings and that multiple statements cannot appear on a single line pretty much blows that claim out of the water.

There are programming idioms, such as manual loop unrolling, which are clearer when multiple statements are allowed on a line.

Also, the tab replacement rule pretty much negates any advantage that using alignment to indicate block nesting gives you because you can't tell when reading the code how the indentation is going to work after tab replacement.

Reply Parent Score: 1

RE[4]: Python is . . .
by Get a Life on Sun 16th Jul 2006 18:36 in reply to "RE[3]: Python is . . ."
Get a Life Member since:
2006-01-01

;

Reply Parent Score: 3

RE[4]: Python is . . .
by Tuishimi on Sun 16th Jul 2006 18:53 in reply to "RE[3]: Python is . . ."
Tuishimi Member since:
2005-07-06

You CAN have multiple statements per line in Python.

Know the language before you comment on it.

Reply Parent Score: 2

RE[4]: Python is . . .
by CrLf on Sun 16th Jul 2006 22:31 in reply to "RE[3]: Python is . . ."
CrLf Member since:
2006-01-03

"There are programming idioms, such as manual loop unrolling, which are clearer when multiple statements are allowed on a line."

And Python allows multiple statements on a single line, using a ";". And code blocks can also have just one line. The following code...

for i in xrange(10): print i; print i*2

...is perfectly valid.

"Also, the tab replacement rule pretty much negates any advantage that using alignment to indicate block nesting gives you because you can't tell when reading the code how the indentation is going to work after tab replacement."

If you have aligned code, and you replace blocks of "n" spaces by tabs, you will end up with consistent results within a single code block.

As I said, people who complain about the indentation "problem" haven't actually used the language.

Reply Parent Score: 1