On Friday 04 February 2005 03:42, Alan Gauld wrote:
> On Thursday 03 February 2005 17:41, Alan Gauld wrote:
> >> In fact the best style of all is neither of the two I showed,
> >> its actually this - which early everyone hates when they see it!
> >>
> >> inf f(x)
> >>    {
> >>    bah()
> >>    }
> >
> >Ugh.  Alan, I won't even try to dispute the study.  But if I have to
> >write code like that, I'll just take up gardening instead.   :}
>
> Look at it conceptually:
>
> XXXXXXXXXXXX
>     XXXXX
>     XXXXX
>     XXXXX
>
> Thats Python! Since you are on this list I suspect you do write
> "code like that" Its just Guido removed the now extraneous {}...

Oh yes, you are absolutely right.  If you remove the braces, all three 
(four?) styles of indentation are conceptually identical AFAICS.  My 
objection is purely personal and aesthetic.  The style above is just 
plain ugly to me.  I'm not clear on which style is which, but I think 
the Allman style(?):

if (foo)
{
  bar;
} 

is also ugly but slightly less so.  The K&R style(?):

if (foo) {
 bar;
}

is what I use in perl.  I wouldn't go so far as to say it's pretty, it's 
just the least ugly of the styles I know about. 

And of course from a personal aesthetic perspective, I think python 
style is much prettier.   Well written python reads like pseudocode. 
It's actually pleasant to read. If a routine is well written, with good 
variable names, etc, you don't even have to know much about python to 
understand what it does.   That's one of the things that attracted me 
to python in the first place.

-- 
Bud Rogers <[EMAIL PROTECTED]>  KD5SZ

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to