Another way to simulate the ternary operator is this:

a = (quantity > 90 and "It is very huge") or "The value is correct"
You have to be careful of semantics of 'and' and 'or'. But in this case
I wonder why you don't just test whether quantity is greater than 90
and assign the corresponding value to a, e.g., :

if quantity > 90:
 a = "It is huge"
else:
 a = "Time for tea."


Clarity is a virtue, and simulating ternary operator doesn't always
serve that end.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to