Another conditional expression candidate (PEP 308)
Paul Rubin
http
Sun Feb 9 23:47:59 EST 2003
Andrew Koenig <ark at research.att.com> writes:
> Roy> If "else: pass" isn't required in the statement, why should
> Roy> "else: None" be required in the expression?
>
> Because "pass" is obviously the only sensible default behavior for
> statements, but None is not obviously the only sensible default value
> for conditional expressions.
Again looking at the Lisp precedent, (cond (x y)) gives nil if x is
false, and that seems to have worked out. So I'm ok with making the
else optional. I'm also ok with making it mandatory.
More information about the Python-list
mailing list