Bob La Quey wrote:
> On Jan 2, 2008 9:25 PM, David Brown <[EMAIL PROTECTED]> wrote:
> > On Wed, Jan 02, 2008 at 08:27:13PM -0800, SJS wrote:
> >
> > >What's amusing is that when I do read python or IAS psuedocode in a book
> > >(or printed out), I annotate it with vertical lines from the initial
> > >keyword to the closing block. That is,
> > >
> > >   while expression1                      while expression1
> > >      if expression2                      |  if expression2
> > >         do something           ===>      |  |  do something
> > >      else                                |  else
> > >         do something else                |  |__do something else
> > >                                          |_____
> >
> > I find the code on the right significantly more difficult to read.  The
> > lines are just noise that make the code harder to find.
> 
> Agreed. Noise is all that was added. I do hope such abortions
> are not being taught.

That simple example is too simple. Imagine, if you will, a function or
block of code that is across two or more sheets.

    % wc -l /usr/bin/reportbug 
    1751 /usr/bin/reportbug
    % echo $[1751/66.0]
    26.530303030303031

Or, 27 printed pages for the reportbug program.

Where is the end of the block? An }, ] end, or | will help you to know.
A bunch of whitespace won't.

Also, Stewart was talking about *printed* code. Likely the line was
drawn with a pencil and a straightedge. Much less visual impact than an
ASCII Veritcal Line.

I do hope such things are taught. It makes seeing the blocks very easy.
You can follow the structure a lot better. If not by the professor, at
least by the TA or one of the smarter students who will likely
rediscover this every new semester.

-john

% c=0;p=66;file {/usr,}/bin/* | sed -ne's/\(.*\):.*python script.*/\1/p' | 
while read i; do l=`cat $i | wc -l`; echo $i: $l lines \($[l/p+1] pages\); 
t=$[t+l];c=$[c+1]; done; echo TOTAL: $t lines in $c python scripts; echo avg: 
$[t/c] lines \($[t/c/p+1] pages\)
/usr/bin/alacarte: 26 lines (1 pages)
 --snip--
/usr/bin/xml2po: 827 lines (13 pages)
TOTAL: 11857 lines in 39 python scripts
avg: 304 lines (5 pages)

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to