Nick Coghlan <ncogh...@gmail.com> writes:

> He keeps leaving [braces] out [when the block is a single statement],
> I occasionally tell him they should always be included (most recently
> this came up when we gave conflicting advice to a patch contributor).

As someone who has maintained his fair share of C code, I am firmly on
the side of unconditionally (!) enclosing C statement blocks in braces
regardless of how many statements they contain.

> He says what he's doing is OK, because he doesn't consider the example
> in PEP 7 as explicitly disallowing it

I wonder if he has a stronger argument in favour of his position,
because “it's not forbidden” doesn't imply “it's okay”.

> I think it's a recipe for future maintenance hassles when someone adds
> a second statement to one of the clauses but doesn't add the braces.

Agreed, it's an issue of code maintainability. Which is enough of a
problem in C code that a low-cost improvement like this should always be
done.

But, as someone who carries no water in the Python developer community,
my opinion has no more force than the arguments, and I can't impose it
on anyone. Take it for what it's worth.

-- 
 \     “God was invented to explain mystery. God is always invented to |
  `\     explain those things that you do not understand.” —Richard P. |
_o__)                                                    Feynman, 1988 |
Ben Finney

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to