[Python-Dev] PEP 7 clarification request: braces

Tim Delaney timothy.c.delaney at gmail.com
Tue Jan 3 01:53:06 CET 2012

On 3 January 2012 09:55, Raymond Hettinger <raymond.hettinger at gmail.com>wrote:

> On Jan 2, 2012, at 2:09 PM, Tim Delaney wrote:
> I'd also point out that if you're expecting braces, not having them can
> make the code less readable.
> If a programmer's mind explodes when they look at the simple and beautiful
> examples in K&R's The C Programming Language, then they've got problems
> that can't be solved by braces ;-)

Now that's just hyperbole ;)

If you've got a mix of braces and non-braces in a chunk of code, it's very
easy for the mind to skip over the non-brace blocks as not being blocks. I
know it's not something I'm likely to mess up when reading the code
in-depth, but if I'm skimming over trying to understand the gist of the
code or looking for what should be an obvious bug, a block that's not
brace-delimited is more likely to be missed than one that is (when amongst
other blocks that are).

If we had the option of "just use indentation" in C I'd advocate that.
Failing that, I find that consistent usage of braces is preferable.


Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120103/12e2e21f/attachment.html>

More information about the Python-Dev mailing list