Bo Peng <[EMAIL PROTECTED]> wrote: > I need to pass a bunch of parameters conditionally. In C/C++, I can do > > func(cond1?a:b,cond2?c:d,.....)
Python does not have a ternary operator analogous to C's :?. There are some ugly hacks you can play with the logical operators to emulate :?, but in my opinion, the cure is worse than the disease. > In Python, I am using temporary variables like > > if cond1: > para1 = a > else: > para1 = b > > # .... > # a bunch of such if/else > > func(para1, para2,...) Yeah, that's how I would do it. How many of these things do you have? -- http://mail.python.org/mailman/listinfo/python-list