proper use of braces in Python (was: Prothon Prototypes vs Python Classes)
Jim Benson
jbenson at sextans.lowell.edu
Tue Mar 30 19:55:47 EST 2004
On Tue, 30 Mar 2004, Michael wrote:
>
> >>Right. Then we can have "does the brace go on the same line or the
> >>next line" wars.
> >>
> >>
> >
> > int main (void)
> > {
> > if (true)
> > {
> > }
> >
> > return 0;
> > }
> >
> >There is no other way.
> >
> >
> No way, that wastes an entire line of code with a single brace!
>
> int main ( void ) {
> if ( true ) {
> return 1;
> }
> return 0;
> }
>
> This is clearly better. Compact yet easy to read. I try formatting my
> Python code exactly like this and it always complains about my braces..
> clearly wrong.
>
>
Hi,
...just a food for thought from a Python list lurker.
I have always been a strong adherent to the
if (true) {
}
form. Not too long ago on this list (i think it was),
someone pointed out that you never see:
If (true) BEGIN:
END
humm...i thought, your right, in that case i guess
i would probably write the BEGIN on a different
line...not sure what indention of the END
i would choose.
Jim
More information about the Python-list
mailing list