PEP 308: "then" "else" for deprecating "and" "or" side effect s
Stephen Horne
intentionally at blank.co.uk
Fri Feb 14 11:23:48 EST 2003
On Fri, 14 Feb 2003 09:10:50 -0600, sismex01 at hebmex.com wrote:
>Note: The condition is worded as "OK" to mean that
>it's checking the "ok condition", and "NOK" when it's
>checking for an exceptional condition.
>
>"a" is the "ok" value, and "b" is the "nok" value.
>
>Summary of simple syntaxes:
I suggested the following elsewhere, but buried in a big post, so...
>* Guido's original suggestion: "a" if OK else "b"
> but some noisy people didn't
> like it's reverse parsing.
I like it to a point, but I'd prefer...
either "a" if OK else "b" [if OK else "c"...]
The 'either' warns that the conditional expression is coming, which in
my view improves readability a lot.
But even better, why not...
if (OK, "a", "b")
Just because it uses lazy evaluation doesn't mean it isn't a function.
--
steve at ninereeds dot fsnet dot co dot uk
More information about the Python-list
mailing list