[Python-Dev] Adding a conditional expression in Py3.0

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Sun Sep 25 19:11:30 CEST 2005

Sokolov Yura wrote:
> Sorry for looking in every hole.
> Just a  suggestion.
> A= condition and first or second
> problem is in case when first in (None,0,[],"").
> May be invent new operator 'take'.
> take - returns right operator when left evals to True and stops 
> computing condidtional expression.
> Then we could write:
> A = condition take first or second.
> A = x==y take w or s
> A = z is not None and q!=12 take [] or allowable(z,q) take [(z,q)] or 
> "Impossible"
> Ok, it might looks ugly. But may be not.

One of the advantages of (if x then y else z) is that it doesn't require
the introduction of a new keyword (I think the "then" could be special-
cased like "as" in the import statement).


Mail address is perfectly valid!

More information about the Python-Dev mailing list