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 143599
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[6]: Python is . . .
by Tuishimi on Sun 16th Jul 2006 18:51 UTC in reply to "RE[4]: Python is . . ."
Tuishimi
Member since:
2005-07-06

"Python indentation is like Pascal's banishing of 'goto' because Wirth didn't understand the situations in which goto made code more readable rather than less."

You have GOT to be kidding me. Please tell me you are kidding me. Code indentation is extremely important to readability. Perhaps I am misunderstanding you. GOTO statements created confusion by providing a somewhat (in appearance anyway) unstructured method of jumping in and out of code segments. Completely different from what we are talking about with code indentation.

Reply Parent Score: 1

RE[7]: Python is . . .
by Cloudy on Sun 16th Jul 2006 19:56 in reply to "RE[6]: Python is . . ."
Cloudy Member since:
2006-02-15

Perhaps I am misunderstanding you.

You're misunderstanding me.

Wirth banished goto from Pascal because it allowed certain 'undesirable' programming constructs. Doing so was an attempt to enforce readability by language design.

Python tries to enforce readability by language design by forcing indentation, including statement termination. But it's easy to write unreadable code in Python just as it was easy to write spaghetti code in Pascal.

By banishing the goto, Wirth actually made some things harder to write clearly, about which see Knuth's paper on goto structuring. So, the net effect was that Pascal didn't prevent unreadable code but did in some instances enforce unreadable code.

By forcing indentation, Python robs the programmer of certain constructs which can be used to indicate code structure, and it causes a different sort of typographic blindness, because of the tab substitution rule.

In other words, Python is like Pascal in that it attempted to do something to make code more readable that didn't really make the code more readable, but did eliminate some changes for readability.

Where you're getting confused about what I'm saying is that C allows one to write code that's at least as readable as Python because it allows one to properly indent. It allows readable code, but it doesn't attempt to enforce it. Whereas Python attempts to enforce readable code, but in doing so merely leads to different ways to write unreadable code while restricting programmers unnecessarily when there's a good reason to violate the convention of indentation.

Reply Parent Score: 1

RE[8]: Python is . . .
by Tuishimi on Sun 16th Jul 2006 20:54 in reply to "RE[7]: Python is . . ."
Tuishimi Member since:
2005-07-06

This was a much more descriptive post! I understand what you are trying to say now. I still don't necessarily agree with what you are saying, but that's fine.

I still don't understand this: "Python robs the programmer of certain constructs which can be used to indicate code structure".

Indentation indicates a block of code, such as a loop, condition or other form of block statement. How does it rob the programmer of constructs that indicate code structure?

Reply Parent Score: 1

RE[7]: Python is . . .
by mexisme on Mon 17th Jul 2006 10:17 in reply to "RE[6]: Python is . . ."
mexisme Member since:
2006-07-17

Code indentation is great... except when it's not.

There are times when I explictly choose not to use indentation, and I get annoyed when a language chooses to tell me, for example "Use underscores instead of camel-case" or "Use spaces instead of tabs for indentation" where the reason is based on opinion.

It's the age-old "thou shalt do it this way" argument with Python, despite the programmer's wishes or better judgement.

And I have to say this: "GOTO" is sometimes just plain better, for all sorts of context-sensitive reasons. The comparison is because Wirth banished GOTO for a readability **opinion**.

Reply Parent Score: 1

RE[8]: Python is . . .
by CrLf on Mon 17th Jul 2006 14:09 in reply to "RE[7]: Python is . . ."
CrLf Member since:
2006-01-03

"And I have to say this: "GOTO" is sometimes just plain better, for all sorts of context-sensitive reasons. The comparison is because Wirth banished GOTO for a readability **opinion**."

I have never used "goto" (although I've used "setjmp", which is even worse).

It can be acceptable to jump into a common error handling block inside a function, but nothing else. And even there, the code can be refactored to avoid it, with other benefits besides eliminating "goto"s.

Other possible uses are in jumping out of deeply nested loops, but if you are doing deeply nested loops, then your code is broken far beyond the use of "goto".

Reply Parent Score: 1