Larry Price wrote:

> : return statements that aren't on either the top or the innermost level
> of a function are a sign of trouble.

Now that's a weird one.  So this code, e.g., is a sign of trouble?

    class StatSample:
        # ...
        def variance(self):
            if len(self) == 0:
                return 0
            sum, sum2 = 0, 0
            for d in self:
                sum += d
                sum2 += d * d
            return (sum2 - (sum * sum) / len(self)) / (len(self) - 1)

As for the "indentation is block structure" part of Python, I disagree
with toman.  That's one of the best things about Python, and I'm
amazed that it took so long for someone to try it.  Otherwise, you're
constantly checking that your indentation matches your curlies.  I've
flushed dozens of bugs out of C code where there's a mismatch.  The
code looks correct, but it executes something different.

The analogy with Fortran IV is false, because Fortran, as most people
practiced it back in the Bronze Age, had no block structure.

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     [EMAIL PROTECTED]
_______________________________________________
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug

Reply via email to