For review: PEP 308 - If-then-else expression
Paul Rubin
http
Sun Feb 9 22:17:07 EST 2003
Erik Max Francis <max at alcyone.com> writes:
> > 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. As someone pointed out,
> some digging discovered that someone suggested it in a proposed PEP
> which never went anywhere several years ago.
>
> It seems to satisfy all the criteria: reads left-to-right, is
> unambiguous, is easy to understand, and requires no new keywords.
It's my favorite too, at this point.
More information about the Python-list
mailing list