
On 18.01.2016 08:00, Victor Stinner wrote:
I like if without braces when the body is only one line, especially when there is no else block.
Same here. Compilers warn about these things today, so I don't think we need to go paranoid ;-)
Victor
Le dimanche 17 janvier 2016, Brett Cannon <brett@python.org> a écrit :
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?
-- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Jan 18 2016)
Python Projects, Coaching and Consulting ... http://www.egenix.com/ Python Database Interfaces ... http://products.egenix.com/ Plone/Zope Database Interfaces ... http://zope.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/