
On Sun, Jan 17, 2016 at 11:12 AM Brett Cannon <brett@python.org> wrote:
While doing a review of http://bugs.python.org/review/26129/ I asked to have curly braces put around all `if` statement bodies. Serhiy pointed out that PEP 7 says curly braces are optional: https://www.python.org/dev/peps/pep-0007/#id5. I would like to change that.
My argument is to require them to prevent bugs like the one Apple made with OpenSSL about two years ago: https://www.imperialviolet.org/2014/02/22/applebug.html. Skipping the curly braces is purely an aesthetic thing while leaving them out can lead to actual bugs.
Anyone object if I update PEP 7 to remove the optionality of curly braces in PEP 7?
+1, always using {}s is just good C style. (and, duh, of course we do *not* go modifying code for this retroactively, pep8 vs our existing python code is evidence of that) If I had _my_ way we'd require clang format for C/C++ files and yapf for all Python files before accepting a commit. Like any good modern open source project should. People who don't like defensive bug reducing coding practices should be glad I don't get my way. :P -gps