Is there something similar to ?: operator (C/C++) in Python?
D H
d at e.f
Fri Jun 24 10:00:04 EDT 2005
Peter Hansen wrote:
> D H wrote:
>
>> Peter Hansen wrote:
>>
>>> Bo Peng wrote:
>>>
>>>> I need to pass a bunch of parameters conditionally. In C/C++, I can do
>>>> func(cond1?a:b,cond2?c:d,.....)
>>>>
>>>> Is there an easier way to do this in Python?
>>>
>>>
>>> Please read the FAQ to learn the answer and much other useful ...
>>
>>
>> The answer is no. Use if statements.
>
>
> Actually that's just one possible answer. Whether it's _the_ answer is
> obviously again a matter of opinion, and as usual we differ.
Quit being such an idiot and refuting everything I say. The answer is
simply no, just use an if statement instead.
More information about the Python-list
mailing list