On 1/1/2012 11:44 PM, Nick Coghlan wrote:
> 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.
> (The only time I consider it reasonable to leave out the braces is for
> one liner if statements, where there's no else clause at all)

Could you explain how these two cases differ with regard to maintenance?

In either case, there are superfluous edits required if the original
author had used braces *always*. Putting a brace on one-liners adds only
a single line to the code -- just like in the if/else case. So, your
argument seems conflicted. Surely, you would think this is a simpler
edit to make and diff to see in a patch file:

 if(cond) {
   stmt1;
+  stmt2;
 }

vs.

-if(cond)
+if(cond) {
   stmt1;
+  stmt2;
+}

Also, the superfluous edits will wrongly attribute the blame for the
conditional to the wrong author.

-- 
Scott Dial
sc...@scottdial.com
_______________________________________________
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