Proposal: function which simulates C ?: operator
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Tue Jul 13 03:55:43 EDT 2004
Peter Hansen wrote:
> Reinhold Birkenfeld wrote:
>
>> Peter Hansen wrote:
>>>It won't happen because (a) it's a trivial function to write
>>>on-demand,
>>
>> How do you write this function without lambda in the call?
>
> Basically, you use if/then like you are "supposed" to. :-)
> But the OP wasn't asking about a short-circuit version, just
> the trivial fully evaluated function approach.
Granted. This or (x and y or z) without y being false...
>>>and (b) there are already several different ways of
>>>spelling it with current Python syntax if you don't want a
>>>function
>>
>> One uglier than the other.
>
> Agreed. Use if/then and save the sanity of your maintenance
> programmers.
>
>>>and (c) I suspect that the requirement for short-circuit
>>>evaluation would actually be *more* common in Python than it
>>>appears it is in C++ based on your very limited sample population.
>>
>> ACK.
>
> Ironic that Bill the Cat changed the meaning of that from
> positive to negative. :-) (Or did he always use mixed-case,
> so that all-caps ACK is still uniquely ASCII?)
Well, I don't know Bill the Cat, should I?
Reinhold
--
Wenn eine Linuxdistribution so wenig brauchbare Software wie Windows
mitbrächte, wäre das bedauerlich. Was bei Windows der Umfang eines
"kompletten Betriebssystems" ist, nennt man bei Linux eine Rescuedisk.
-- David Kastrup in de.comp.os.unix.linux.misc
More information about the Python-list
mailing list