PEP308 - preference for 'x if c else y' over 'c then x else y'

Stephen Horne intentionally at blank.co.uk
Mon Feb 17 04:30:44 CET 2003


On Mon, 17 Feb 2003 00:40:29 GMT, Andrew Koenig <ark at research.att.com>
wrote:

>Stephen> Yes - as I said in my post, and as you even included in the quote...
>
>Stephen> (except
>Stephen> in that lazy evaluation can ignore subexpressions which are
>Stephen> not needed, but which might otherwise trigger errors).
>
>Stephen> In your example, if e(x) is true, f(x) is not needed as it cannot
>Stephen> affect the result - but its evaluation could trigger an error.
>
>Stephen> So what are you contradicting me on, exactly?
>
>If lazy evaluation can ignore unneeded subexpressions, but is not
>required to do so, then you have the uncomfortable situation that
>your program might fail on one implementation but not on another.

I never said that lazy evaluation should be an implementation
decision. I said it was a matter for the function declaration or
definiton to specify (like var parameters in Pascal, perhaps) or, for
built-in functions, for the manual to specify.

So I repeat...

So what are you contradicting me on, exactly?

-- 
steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list