For review: PEP 308 - If-then-else expression
holger krekel
pyth at devel.trillke.net
Sun Feb 9 22:56:51 EST 2003
Erik Max Francis wrote:
> Andrew Koenig wrote:
>
> > Me too. But seriously, what's wrong with
> >
> > x = if y < 5: "Yep" else: "Nope"
> >
> > I would hope the meaning is immediately obvious...
>
> Nothing at all, I don't think. I suggested it early on in the thread
> (required parentheses or no), and it's been suggested independently (as
> far as I can tell) at least two more times.
this makes the parsing process ambigous because an expression
can also be a statement. With
if y<5: "Yep" ...
the parser would still have no idea at "Yep" what
it is dealing with. And i'd probably think that
if if y<5: yep() else: 0:
is the result of some editor-accident :-)
holger
More information about the Python-list
mailing list