Conditional operator in Python?
Rainer Deyke
root at rainerdeyke.com
Sun Apr 1 00:02:38 EST 2001
"Emile van Sebille" <emile at fenx.com> wrote in message
news:9a631k$3s8qb$1 at ID-11957.news.dfncis.de...
> Yes, it comes up. Generally, except for short-circuiting, the solutions
> follow:
>
> >>> 1 and 2 or 3
> 2
> >>> 0 and 2 or 3
> 3
This is not equivalent in the general case.
0 ? 0 : 1 --> 0
0 and 0 or 1 --> 1
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list