[Python-Dev] PEP 7 clarification request: braces
Nick Coghlan
ncoghlan at gmail.com
Mon Jan 2 09:31:00 CET 2012
On Mon, Jan 2, 2012 at 4:22 PM, Ron Adam <ron3200 at gmail.com> wrote:
> The problem is only when an additional statement is added to the last
> block, not the preceding ones, as the compiler will complain about
> those. So I don't know how the 4 line example without braces is any
> worse than a 2 line if without braces.
Even when the compiler picks it up, it's still a wasted edit-compile
cycle. More importantly though, this approach makes the rules too
complicated. "Always use braces" is simple and easy, and the only cost
is the extra line of vertical whitespace for the closing brace.
(I personally don't like even the exception made for single clause if
statements, but that's already too prevalent in the code base to do
anything about. Hence the 4-line example in my original post.)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list