Georg Brandl wrote: > Jeffrey Schwab wrote: >> [EMAIL PROTECTED] wrote: >> >>> I want the equivalent of this: >>> >>> if a == "yes": >>> answer = "go ahead" >>> else: >>> answer = "stop" >>> >> def mux(s, t, f): >> if s: >> return t >> return f > > But be aware that this is not a complete replacement for a syntactic > construct. With that function, Python will always evaluate all three > arguments, in contrast to the and/or-form or the Python 2.5 conditional.
Absolutely true, and I should have mentioned it. In languages that allow ?: syntax, I rarely rely on its short-circuit effect, but it certainly is a significant difference. -- http://mail.python.org/mailman/listinfo/python-list