A defense for bracket-less code
Carl Banks
invalidemail at aerojockey.com
Wed Apr 26 17:33:00 EDT 2006
Edward Elliott wrote:
> 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.
Thus proving the original claim about it being confusing. :) I think
he intended it to parse this way:
if ($x) { $y++ if $z; } else { $z--; }
Carl Banks
More information about the Python-list
mailing list