PEP 308 vote type (was Re: Update to PEP308: if-then-else expression)

Scott David Daniels Scott.Daniels at Acm.Org
Tue Feb 11 22:37:16 EST 2003


Delaney, Timothy C (Timothy) wrote:
> ...
> +1 on bool.if(self, trueresult, falseresult)
> 
> where `if` obviously needs to be replaced with something else e.g.
>     (x == y).ifelse(True, False)
> 
> which of course will not be an option in the voting because it
 > doesn't short-circuit;

I like the ifelse like this:
      print count, 'test%s' % (count > 1).ifelse('s', '')

And for the need to be lazy:
      (x > 43).ifelse(lambda:funct(x), lambda:'too many')()

I don't see a problem with asking for lazy where you need it
if we have the way to spell it.

-Scott David Daniels
Scott.Daniels at Acm.Org





More information about the Python-list mailing list