Why so few Python jobs?

Tim Hammerquist tim at vegeta.ath.cx
Tue Sep 25 07:22:26 CEST 2001


Me parece que Peter Hansen <peter at engcorp.com> dijo:
> Tim Hammerquist wrote:
> >
> > A good argument.  One of my favorite things about Python is that I never
> > run the risk of having to maintain code like this:
> > 
> > sub myfunc {
> > do_stuff();
> > do_some_more_stuff();
> > $screw = with @some_variables;
> > for $item (@some_variables){
> > do_stuff();
> > and_some_more(); }
> > do_a_bit_more();
> > blah;
> > }
> 
> What's so bad about this?!

Heh.  Good thing you didn't ask me when I had to maintain this code. I
would've bitten your head off...so to speak...I hope.  <wink>

> It's just indentation with a tabsize of zero... ;-)
> 
> -is-that-really-<shudder>-perl?-ly yr's,

It parses, yes.  But C code of the same format would parse as well.
However, no instructor I've ever had would have accepted it.  They'd
have said, "Rewrite the code structure, turn it back in, and accept a
10% deduction from the final score for late work.

No Perl module from CPAN has this form, nor any code posted to c.l.p.m
(other than from newbies).  Larry Wall suggests a 4-wide tabs with open
and closing braces in corresponding columns.  The above code would
result in:

sub myfunc
{
    do_stuff();
    do_some_more_stuff();
    $screw = with @some_variables;
    for $item (@some_variables)
    {
        do_stuff();
        and_some_more();
    }
    do_a_bit_more();
    blah;
}

(at which point the Python side of my brain kicks in and says, "Well,
there's two perfectly good screen lines wasted with one character...")

<why-do-you-think-Python-is-so-oft-recommended-in-c.l.p.m>-ly yr's,
Tim

-- 
I'm already not yet convinced.
    -- Larry Wall



More information about the Python-list mailing list