On Sep 27, 2006, at 9:13 AM, Russell Campbell wrote:

To me, this was a poor design decision. I can't see NASA using Python for anything . . . "Well, the reason the first human mission to Mars failed was because someone accidentally deleted a Tab character, didn't notice it, and the landing program behaved differently than originally speced out." Ok, that's an extreme example, but the behavior of my programs matters just as much to my clients. At least with block delimiters like ENDIF, you and the program always know when a statement will execute even when someone has
accidentally changed indentation.  It's as bad a design flaw as
case-sensitivity.

It's as bad a design flaw as ENDIF is. Your example of a missing tab would have the same result as a missing ENDIF - the code would not compile when it was run. You'd get an error, and go back and fix it. I know, because now that I code so much in Python, I routinely forget to include ENDIFs, ENDFORs, etc. in my VFP code. They don't go by unnoticed, though - the first time I run the code the compiler lets me know in no uncertain terms!

Eric Raymond recounted his experience with his first coding in Python (http://www.linuxjournal.com/article/3882). His initial reaction was like yours:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I immediately tripped over the first odd feature of Python that everyone notices: the fact that whitespace (indentation) is actually significant in the language syntax. The language has no analog of the C and Perl brace syntax; instead, changes in indentation delimit statement groups. And, like most hackers on first realizing this fact, I recoiled in reflexive disgust.

I am just barely old enough to have programmed in batch FORTRAN for a few months back in the 1970s. Most hackers aren't these days, but somehow our culture seems to have retained a pretty accurate folk memory of how nasty those old-style fixed-field languages were. Indeed, the term ``free format'', used back then to describe the newer style of token-oriented syntax in Pascal and C, has almost been forgotten; all languages have been designed that way for decades now. Or almost all, anyway. It's hard to blame anyone, on seeing this Python feature, for initially reacting as though they had unexpectedly stepped in a steaming pile of dinosaur dung.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        Then later, when he actually began using it, things changed:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Of course, this brought me face to face once again with Python's pons asinorum, the significance of whitespace. This time, however, I charged ahead and roughed out some code for a handful of sample GUI elements. Oddly enough, Python's use of whitespace stopped feeling unnatural after about twenty minutes. I just indented code, pretty much as I would have done in a C program anyway, and it worked.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

That's pretty much what happened with me. I thought it was wrong, wrong, wrong, but did it because I had to. Once I started working that way, it wasn't odd at all - after all, I am pretty religious about indentation in my Fox code. After an hour or two it seemed perfectly natural, and now having to write ENDIFs seems silly.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to