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 143581
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Python is . . .
by Cloudy on Sun 16th Jul 2006 18:11 UTC 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[5]: Python is . . .
by Get a Life on Sun 16th Jul 2006 18:59 in reply to "RE[4]: Python is . . ."
Get a Life Member since:
2006-01-01

Especially if you're going to make the same comment three times.

Reply Parent Score: 1

RE[5]: Python is . . .
by Cloudy on Sun 16th Jul 2006 20:05 in reply to "RE[4]: Python is . . ."
Cloudy Member since:
2006-02-15

Teach me, Obi Wan.

I know you can have multiple expressions[i] on a line. Where is the language in the reference manual that allows me to have multiple [i]statements?

If I'm wrong, than I have learned the language poorly, and I withdraw that particular criticism.

Reply Parent Score: 1

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

RE[5]: Python is . . .
by Cloudy on Mon 17th Jul 2006 01:26 in reply to "RE[4]: Python is . . ."
Cloudy Member since:
2006-02-15

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.

Yes. But if you aren't doing the replacement consistently, you can end up with code that looks properly indented when displayed, but that the compiler treats as having different indentation than you think you see.

I'd try to show you an example, but since OSNews' display software eats tabs and spaces, you can't actually show valid Python code with it.

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

I've used it. I miessed that ';' was allowed as a statement separator, and withdraw the comments about it, but I still hold the comments about indentation level not being unambiguously determinable (which wikipedia agrees with.)

Reply Parent Score: 1