A defense for bracket-less code
Edward Elliott
nobody at 127.0.0.1
Wed Apr 26 15:41:55 EDT 2006
Stelios Xanthakis wrote:
> Also, I think that perl does that because otherwise code like
>
> if ($x) $y++ if $z; else $z--;
>
> would be even more confusing :)
With or without braces, that's not legal code. A one-line if can't be
followed by an else. The closest you can do is this:
$y++ if $z;
$z-- if !$z;
but that's two statements. Your example would need braces even if they were
optional.
More information about the Python-list
mailing list