Proposal: function which simulates C ?: operator

Reinhold Birkenfeld reinhold-birkenfeld-nospam at
Mon Jul 12 10:58:08 CEST 2004

Peter Hansen wrote:
> Adal Chiriliuc wrote:
>> I didn't know this was discussed so much in the past. I should have
>> searched before.
> And if you read all of it, you probably wouldn't be making
> the following suggestion, either.  :-)
>> I now suggest that this function be added without implying that it's
>> the Python equivalent of ?: and with the docs clearly explaining that
>> it's not ?: and how it differs. 
> 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?

> 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.

> 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.



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