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

Andrew Bennetts andrew-pythonlist at
Wed Feb 12 02:46:34 CET 2003

On Wed, Feb 12, 2003 at 12:10:04PM +1100, 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;

This is the first ternary proposal that I actually like rather than actively

It's a shame that short-circuiting is considered a requirement; I'm happy
for people to do it the "hard" way in the few cases where it matters, and it
would allow this proposal, which is just a simple method of bools.  Very
easy to implement, very easy to explain, and very easy to document (and to
find in the documentation -- just look for ifelse in the index!).


More information about the Python-list mailing list