Why whitespace denotation of blocks doesn't work.

Bob Hays, Computer Geek rhays at interaccess.com
Mon Jun 19 07:30:20 EDT 2000


You've misunderstood some of my response, so I'll try to clear it up.

>>I've gotten in the habit of putting the comment DEBUG on such lines in
>>all programming languages; depending upon indention is very dangerous
>>for debug lines since someone else may reindent the line properly and
>>then it gets left in (since they didn't know it was a debug line).
>>
>I never check in code with debug lines in it, so I never have to worry
>about others changing it. That's the whole point, it makes it easier
>to remove.

Good for you - you've been perfect and never, due to time constraints,
checked something in that had a debug line in it.  Congrats!

>>>2) You can easily insert a tab introducing a bug.  Consider the
>>>following code ( similar to a bug I recently fixed ):
>>{Example skipped}
>>>Initially the line in error was indented correctly, but someplace
>>>along the line the extra tab was introduced. A lot of effort then had
>>>to go in to finding this bug. With begin...end or braces this is less
>>>likely to happen.
>>
>>Yep, this happens.  Its a tradeoff - speed vs. occasional extra work.
>What increases in speed do you get by having to type braces?

The code can be typed in much faster; its SLOWER to type in the
braces.

>>In addition, I had an example, in C++, where someone had commented out
>>a block of code, but then had an embedded inline comment inside that
>>block, and, to top it all off, the less-than-desired commented out
>>block would still compile - the guy worked on that bug for a day
>>before coming to me.  I loaded it into emacs and the color coding told
>>him immediately what had happened; he was very ashamed and angry, but
>>I told him sh*t happens:-).
>>
>But that's the point. His code was illegal, it wouldn't compile. Easy
>to catch with emacs, and the compiler will catch it too. The little
>typo I show is easy to make and perfectly legal code. Its hard to
>accidentally bump against a keyboard and make a similar nasty typo.
>EVen something that looks like it might work like }{ would have to be
>put in just the right spot.

No, you didn't read carefully.  His could *WOULD* compile, but it ran
somewhat wrong (obviously) and he wasted a sinful amount of time and
energy trying to find the problem.

>>>3) Finally. Python is a language where it is almost easy to write
>>>extensible programs. To illistrate what I mean consider this example
>>>of a python program I recently wrote:
>>
>>Here's were we will agree to disagree, I think.  I think its way
>>faster and easier to extend Python stuff than C++ (and Java) due to
>>the lack of compile/link cycle and due to inheritance inside of
>>Python.  Yep, you have to be careful how you indent, but if you have a
>>good editor it will cut/copy/paste as-is without reindenting.  I see
>>more problems due to bad cut/copy/paste reuse in all programming
>>languages than I do from mis-indenting so far.
>>
>I think you misunderstood what I said. I think that Python is not now
>easily extensible do to the  problems with whitespaces. If that were
>fixed then Python would be easily extensible. 
{lots removed}

But I do understand.  Good reuse would be to not copy but to reuse via
inheritence or reinvocation - copy/paste reuse is always fraught with
problems, and that's part of what OOP should help avoid (although I've
always thought structured programming (SP) could deal with this
problem also - its code size that limits SP).
--
Bob Hays                           "Discipline is never an end in
181 W. Madison                      itself, only a means to an end."
MS 4000                            -- King Crimson
Chicago, IL  60602                 "Whoever flees history will be
(312) 904-4668 (V)                  pursued by history."
(312) 904-5774 (F)                 -- Janusz Korczak
Bob.Hays at abnamro.com               "Faster! Faster! Until the thrill
rhays at interaccess.com               of speed overcomes the fear of
                                    death."
                                   -- Hunter S. Thompson
                                   "Security is very frequently the
                                    commencement of calamity." 
                                   -- Paterculus
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d+(-)@ s+:+ a C++(+++)$ U$ P+$ L@ E+++$ W+++$ N++ !o-- K--? w$ !O 
M$ V@ PS+ PE !Y+ PGP t !5-- !X !R tv+ b++() DI+ !D- G-- e++ h--- r+++ 
y+++** 
------END GEEK CODE BLOCK------



More information about the Python-list mailing list