PEP 308 vote type (was Re: Update to PEP308: if-then-else expression)
Andrew Bennetts
andrew-pythonlist at puzzling.org
Tue Feb 11 23:39:01 EST 2003
On Tue, Feb 11, 2003 at 07:37:16PM -0800, Scott David Daniels wrote:
>
> 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.
Agreed. Hell, you could even do:
if x > 43:
y = funct(x)
else:
y = 'too many'
But that's probably too radical to be accepted <wink>
-Andrew.
More information about the Python-list
mailing list