[Python-Dev] PEP 7 clarification request: braces

Petri Lehtinen petri at digip.org
Mon Jan 2 14:24:28 CET 2012


Antoine Pitrou wrote:
> I don't like having the else on the same line as the closing brace,
> and prefer:
>> if (cond) {
> statement;
> }
> else {
> statement;
> }

And this is how it's written in PEP-7. It seems to me that PEP-7
doesn't require braces. But it explicitly forbids
 if (cond) {
 statement;
 } else {
 statement;
 }
by saying "braces as shown", and then showing them like this:
 if (mro != NULL) {
 ...
 }
 else {
 ...
 }
> That said, I agree with Benjamin: the shorter form is visually lighter
> and should not be frown upon.

Me too.


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /