Compare source code

Steve Holden steve at holdenweb.com
Mon Nov 8 16:55:46 CET 2010


On 11/8/2010 8:50 AM, Neil Cerutti wrote:
[...]
> Interesting. I find conserving vertical space to be a big win. I
> understand why you'd enforce braces for virtually all code bodies
> in C. In C, I'm giving up the most obvious form of expression for
> something obviously more robust. In Python, there's no such
> trade-off. Forbidding one-line conditional statements in Python
> would sacrifice succinctness for nothing.

One-line conditional statements aren't "forbidden" or they would not be
grammatically correct. Many stylists (and the PEP 8 style guide) eschew
the single-line form as less readable because the guarded suites (in
this case, simple statements) are not flagged as clearly by indentation
or a trailing colon, and are therefore more likely to be missed by the
casual reader.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list