PEP 308: Alternative conditional operator forms -- Corner Case solved

Terry Reedy tjreedy at udel.edu
Fri Feb 14 20:57:32 EST 2003


"Andrew Koenig" <ark at research.att.com> wrote in message
news:yu99smusakrf.fsf at europa.research.att.com...
> Terry> Given this understanding (which I realize I should explain
> Terry> further),

I just did so this evening.  See (PEP-308) Python's Conditional
Selection Operators,

>Yes, it is straightforward and obvious.

Thanks for saying so.  Others keeps denying even 'straightforward'.

> It is also wrong.

I agree that expecting some to be something it is not is wrong.  But I
don't do that, at least not in this case.

> The reason it is wrong is the result when a is true and b is false.

But it is 'right' otherwise.  For this case, '(not a or b) and c' is
right (see the post referenced above).

> If (a and b or c) were really a conditional selection expression,

By reasonable definition of 'conditional', 'selection', and
expression', it really is.  Its truth-result table is just not quite
the one that people usually want.

> then you would expect the result to be b

No I would not.  I worked out the truth-result table several years
ago.

>.  In fact, it is c.

As I have known for years.

Yesterday, I worked out two (somewhat baroque) and/or expressions that
exactly match 'if a then b else c', so it actually is possible.

Terry J. Reedy







More information about the Python-list mailing list