peter at engcorp.com
Thu Sep 26 08:34:23 EDT 2002
Mike Rovner wrote:
> "Greg Ewing" <see_reply_address at something.invalid> wrote in message
> news:3D911FE1.1050801 at something.invalid...
> > thp at cs.ucr.edu wrote:
> > Personally, I rather like
> > a if b else c
> > but Guido doesn't like that either, unfortunately.
> > Perhaps I'll slip it into Pyrex when no-one's looking...:-)
> It's not as readable as one think ;)
Agreed! If nothing else, it fails the test of Least Surprise.
You have to stop and think "does the conditional test *really*
lie in the middle of this expression?".
> I, personally, read this as 'take a if b is true else take c' which
> corresponds to 'b? a: c' in C.
Surely that's exactly what he meant?
> So, please, don't create ambiguity from nowhere.
I'm not so sure it's ambiguous, as surprising. Would anyone
really interpret that differently, after they stopped to think?
More information about the Python-list